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