File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,19 @@ macro(swift_supports_implicit_module module_name out_var)
2121 )
2222endmacro ()
2323
24+ function (swift_get_swiftlang_version out_var)
25+ execute_process (
26+ COMMAND "${CMAKE_Swift_COMPILER} " -version
27+ OUTPUT_VARIABLE output ERROR_VARIABLE output
28+ RESULT_VARIABLE result
29+ TIMEOUT 10
30+ )
31+
32+ if (output MATCHES [[swiftlang-([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)]])
33+ set ("${out_var} " "${CMAKE_MATCH_1} " PARENT_SCOPE)
34+ endif ()
35+ endfunction ()
36+
2437# Get "package cross-module-optimization" compiler arguments suitable for the compiler.
2538function (swift_get_package_cmo_support out_var)
2639 # > 6.0 : Fixed feature.
@@ -42,8 +55,13 @@ function(swift_get_package_cmo_support out_var)
4255 -Xfrontend -experimental-package-bypass-resilience
4356 )
4457 if (result)
45- set (${out_var} EXPERIMENTAL PARENT_SCOPE)
46- return ()
58+ # Package CMO is implmented in Xcode 16 Beta 4 (swiftlang-6.0.0.6.8) or later.
59+ # Consider it's not supported in non Xcode toolchain with "-experimental" options.
60+ swift_get_swiftlang_version(swiftlang_version)
61+ if (swiftlang_version AND swiftlang_version VERSION_GREATER_EQUAL 6.0.0.6)
62+ set (${out_var} EXPERIMENTAL PARENT_SCOPE)
63+ return ()
64+ endif ()
4765 endif ()
4866
4967 # < 6.0 : Not supported.
You can’t perform that action at this time.
0 commit comments