@@ -3,23 +3,23 @@ include(CheckIncludeFileCXX)
33include (FindPackageHandleStandardArgs)
44
55check_cxx_compiler_flag(/await Coroutines_SUPPORTS_MS_FLAG)
6- check_cxx_compiler_flag(-fcoroutines-ts Coroutines_ts_SUPPORTS_GNU_FLAG )
7- check_cxx_compiler_flag(-fcoroutines Coroutines_SUPPORTS_GNU_FLAG )
8- if (Coroutines_SUPPORTS_MS_FLAG OR Coroutines_ts_SUPPORTS_GNU_FLAG OR Coroutines_SUPPORTS_GNU_FLAG )
6+ check_cxx_compiler_flag(-fcoroutines-ts Coroutines_SUPPORTS_COROUTINES_TS_FLAG )
7+ check_cxx_compiler_flag(-fcoroutines Coroutines_SUPPORTS_COROUTINES_FLAG )
8+ if (Coroutines_SUPPORTS_MS_FLAG OR Coroutines_SUPPORTS_COROUTINES_TS_FLAG OR Coroutines_SUPPORTS_COROUTINES_FLAG )
99 set (Coroutines_COMPILER_SUPPORT ON )
1010endif ()
1111
1212if (Coroutines_SUPPORTS_MS_FLAG)
13- check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "/await" )
14- check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "/await" )
15- elseif (Coroutines_ts_SUPPORTS_GNU_FLAG)
16- check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "-fcoroutines-ts" )
17- check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "-fcoroutines-ts" )
18- elseif (Coroutines_SUPPORTS_GNU_FLAG)
19- check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "-fcoroutines" )
20- check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "-fcoroutines" )
13+ set (Coroutines_EXTRA_FLAGS "/await" )
14+ elseif (Coroutines_SUPPORTS_COROUTINES_TS_FLAG)
15+ set (Coroutines_EXTRA_FLAGS "-fcoroutines-ts" )
16+ elseif (Coroutines_SUPPORTS_COROUTINES_FLAG)
17+ set (Coroutines_EXTRA_FLAGS "-fcoroutines" )
2118endif ()
2219
20+ check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT ${Coroutines_EXTRA_FLAGS} )
21+ check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT ${Coroutines_EXTRA_FLAGS} )
22+
2323if (Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT OR Coroutines_STANDARD_LIBRARY_SUPPORT)
2424 set (Coroutines_LIBRARY_SUPPORT ON )
2525endif ()
@@ -33,12 +33,4 @@ if(NOT CppcoroCoroutines_FOUND OR TARGET cppcoro::coroutines)
3333endif ()
3434
3535add_library (cppcoro::coroutines INTERFACE IMPORTED )
36- if (Coroutines_SUPPORTS_MS_FLAG)
37- target_compile_options (cppcoro::coroutines INTERFACE /await)
38- elseif (Coroutines_ts_SUPPORTS_GNU_FLAG)
39- target_compile_options (cppcoro::coroutines INTERFACE -fcoroutines-ts)
40- elseif (Coroutines_SUPPORTS_GNU_FLAG)
41- target_compile_options (cppcoro::coroutines INTERFACE -fcoroutines)
42- endif ()
43-
4436target_compile_options (cppcoro::coroutines INTERFACE ${Coroutines_EXTRA_FLAGS} )
0 commit comments