Skip to content

Commit 645c6d1

Browse files
committed
Add support for -fcoroutines in addition to -fcoroutines-ts
1 parent 1af2f24 commit 645c6d1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

cmake/FindCppcoroCoroutines.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@ include(CheckIncludeFileCXX)
33
include(FindPackageHandleStandardArgs)
44

55
check_cxx_compiler_flag(/await Coroutines_SUPPORTS_MS_FLAG)
6-
check_cxx_compiler_flag(-fcoroutines-ts Coroutines_SUPPORTS_GNU_FLAG)
7-
if(Coroutines_SUPPORTS_MS_FLAG OR Coroutines_SUPPORTS_GNU_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)
89
set(Coroutines_COMPILER_SUPPORT ON)
910
endif()
1011

1112
if(Coroutines_SUPPORTS_MS_FLAG)
1213
check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "/await")
1314
check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "/await")
14-
elseif(Coroutines_SUPPORTS_GNU_FLAG)
15+
elseif(Coroutines_ts_SUPPORTS_GNU_FLAG)
1516
check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "-fcoroutines-ts")
1617
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")
1721
endif()
1822

1923
if(Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT OR Coroutines_STANDARD_LIBRARY_SUPPORT)
@@ -31,6 +35,8 @@ endif()
3135
add_library(cppcoro::coroutines INTERFACE IMPORTED)
3236
if(Coroutines_SUPPORTS_MS_FLAG)
3337
target_compile_options(cppcoro::coroutines INTERFACE /await)
34-
elseif(Coroutines_SUPPORTS_GNU_FLAG)
38+
elseif(Coroutines_ts_SUPPORTS_GNU_FLAG)
3539
target_compile_options(cppcoro::coroutines INTERFACE -fcoroutines-ts)
40+
elseif(Coroutines_SUPPORTS_GNU_FLAG)
41+
target_compile_options(cppcoro::coroutines INTERFACE -fcoroutines)
3642
endif()

0 commit comments

Comments
 (0)