@@ -35,19 +35,29 @@ endif()
3535set (SWIFT_RUNTIME_CONCURRENCY_C_FLAGS)
3636set (SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS)
3737
38+ check_cxx_compiler_flag(-fswift-async-fp=always CXX_COMPILER_HAS_SWIFT_ASYNC_FP_FLAG)
39+
3840if (NOT swift_concurrency_async_fp_mode)
3941 set (swift_concurrency_async_fp_mode "always" )
4042endif ()
4143
42- # Don't emit extended frame info on platforms other than darwin, system
43- # backtracer and system debugger are unlikely to support it.
44+ # Don't emit extended frame info on platforms other than darwin, if the compiler
45+ # has that flag, as the system backtracer and system debugger are unlikely to
46+ # support it.
4447if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
45- list (APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS
46- "-fswift-async-fp=${swift_concurrency_async_fp_mode} " )
47- list (APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
48- "-Xfrontend"
49- "-swift-async-frame-pointer=${swift_concurrency_async_fp_mode} " )
50- else ()
48+ if (CXX_COMPILER_HAS_SWIFT_ASYNC_FP_FLAG)
49+ list (APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS
50+ "-fswift-async-fp=${swift_concurrency_async_fp_mode} " )
51+ list (APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
52+ "-Xfrontend"
53+ "-swift-async-frame-pointer=${swift_concurrency_async_fp_mode} " )
54+ else ()
55+ message (ERROR
56+ "The -fswift-async-fp clang flag is not available. This is most likely "
57+ "because you are using the Xcode toolchain, which may not have the "
58+ "latest flags yet." )
59+ endif ()
60+ elseif (CXX_COMPILER_HAS_SWIFT_ASYNC_FP_FLAG)
5161 list (APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS "-fswift-async-fp=never" )
5262endif ()
5363
0 commit comments