@@ -15,6 +15,21 @@ if(Coroutines_SUPPORTS_MS_FLAG)
15
15
elseif (Coroutines_ts_SUPPORTS_GNU_FLAG)
16
16
check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "-fcoroutines-ts" )
17
17
check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "-fcoroutines-ts" )
18
+ # workaround:
19
+ # clang not find stdlibc++ headers when on ubuntu 20.04
20
+ # So, we retry with libc++ enforcement
21
+ if (NOT Coroutines_STANDARD_LIBRARY_SUPPORT
22
+ AND NOT Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT
23
+ AND CMAKE_CXX_COMPILER_ID MATCHES Clang)
24
+ set (CMAKE_REQUIRED_FLAGS "-stdlib=libc++" )
25
+ check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT_LIBCPP "-fcoroutines-ts" )
26
+ check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT_LIBCPP "-fcoroutines-ts" )
27
+ if (Coroutines_STANDARD_LIBRARY_SUPPORT_LIBCPP OR Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT_LIBCPP)
28
+ list (APPEND Coroutines_EXTRA_FLAGS "-stdlib=libc++" )
29
+ set (Coroutines_STANDARD_LIBRARY_SUPPORT ${Coroutines_STANDARD_LIBRARY_SUPPORT_LIBCPP} )
30
+ set (Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT ${Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT_LIBCPP} )
31
+ endif ()
32
+ endif ()
18
33
elseif (Coroutines_SUPPORTS_GNU_FLAG)
19
34
check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "-fcoroutines" )
20
35
check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "-fcoroutines" )
@@ -40,3 +55,5 @@ elseif(Coroutines_ts_SUPPORTS_GNU_FLAG)
40
55
elseif (Coroutines_SUPPORTS_GNU_FLAG)
41
56
target_compile_options (cppcoro::coroutines INTERFACE -fcoroutines)
42
57
endif ()
58
+
59
+ target_compile_options (cppcoro::coroutines INTERFACE ${Coroutines_EXTRA_FLAGS} )
0 commit comments