Skip to content

Commit 26959a6

Browse files
committed
fix compilation logic
1 parent 5529feb commit 26959a6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cmake/FindCoroutines.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,22 @@ endif()
150150

151151
if(find_final)
152152
check_include_file_cxx("coroutine" _CXX_COROUTINES_HAVE_HEADER)
153+
if(_CXX_COROUTINES_HAVE_HEADER)
154+
check_cxx_source_compiles("#include <coroutine> \n typedef std::suspend_never blub; \nint main() {} " _CXX_COROUTINES_FINAL_HEADER_COMPILES)
155+
set(_CXX_COROUTINES_HAVE_HEADER ${}_CXX_COROUTINES_FINAL_HEADER_COMPILES})
156+
endif()
157+
153158
if(NOT _CXX_COROUTINES_HAVE_HEADER)
154159
cmake_push_check_state()
155160
set(CMAKE_REQUIRED_FLAGS "${_CXX_COROUTINES_EXTRA_FLAGS}")
156161
check_include_file_cxx("coroutine" _CXX_COROUTINES_HAVE_HEADER_WITH_FLAG)
162+
if(_CXX_COROUTINES_HAVE_HEADER_WITH_FLAG)
163+
check_cxx_source_compiles("#include <coroutine> \n typedef std::suspend_never blub; \nint main() {} " _CXX_COROUTINES_FINAL_HEADER_COMPILES_WITH_FLAG)
164+
set(_CXX_COROUTINES_HAVE_HEADER_WITH_FLAG ${_CXX_COROUTINES_FINAL_HEADER_COMPILES_WITH_FLAG})
165+
endif()
157166
set(_CXX_COROUTINES_HAVE_HEADER ${_CXX_COROUTINES_HAVE_HEADER_WITH_FLAG})
158167
cmake_pop_check_state()
159168
endif()
160-
check_cxx_source_compiles("#include <coroutine> \n typedef std::suspend_never blub; \nint main() {} " _CXX_COROUTINES_FINAL_HEADER_COMPILES)
161-
if(NOT _CXX_COROUTINES_FINAL_HEADER_COMPILES)
162-
set(_CXX_COROUTINES_HAVE_HEADER FALSE)
163-
endif()
164169
mark_as_advanced(_CXX_COROUTINES_HAVE_HEADER)
165170
if(_CXX_COROUTINES_HAVE_HEADER)
166171
# We found the non-experimental header. Don't bother looking for the

0 commit comments

Comments
 (0)