@@ -37,39 +37,46 @@ if(NOT SwiftCore_ARCH_SUBDIR)
37
37
message (CONFIGURE_LOG "Swift Arch: ${arch} " )
38
38
endif ()
39
39
40
- set (availability_platform_macosx "macOS" )
41
- set (availability_platform_ios "iOS" )
42
- set (availability_platform_watchos "watchOS" )
43
- set (availability_platform_tvos "tvOS" )
44
- set (availability_platform_xros "visionOS" )
45
- set (availability_platform_bridgeos "bridgeOS" )
40
+ if (APPLE )
46
41
47
- if (NOT SwiftCore_SWIFT_AVAILABILITY_PLATFORM )
48
- if (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)-simulator$" )
49
- set (platform "${CMAKE_MATCH_1} " )
50
- elseif (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)$" )
51
- set (platform "${CMAKE_MATCH_1} " )
52
- else ()
53
- message (FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_MODULE_TRIPLE} " )
54
- endif ()
42
+ # Note: *moduleTriple* doesn't have an "x" on the end of "macos"; just to be
43
+ # safe, we support both cases here.
44
+ set (availability_platform_macos "macOS" )
45
+ set (availaiblity_platform_macosx "macOS" )
46
+ set (availability_platform_ios "iOS" )
47
+ set (availability_platform_watchos "watchOS" )
48
+ set (availability_platform_tvos "tvOS" )
49
+ set (availability_platform_xros "visionOS" )
50
+ set (availability_platform_bridgeos "bridgeOS" )
55
51
56
- if (availability_platform_${platform} )
57
- set (SwiftCore_SWIFT_AVAILABILITY_PLATFORM "${availability_platform_${platform} }" )
58
- else ()
59
- message (FATAL_ERROR "Unknown platform ${platform} for availability" )
60
- endif ()
61
- endif ()
52
+ if (NOT SwiftCore_SWIFT_AVAILABILITY_PLATFORM )
53
+ if (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)-simulator$" )
54
+ set (platform "${CMAKE_MATCH_1} " )
55
+ elseif (SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)$" )
56
+ set (platform "${CMAKE_MATCH_1} " )
57
+ else ()
58
+ message (FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_MODULE_TRIPLE} " )
59
+ endif ()
62
60
63
- if (SwiftCore_VARIANT_MODULE_TRIPLE )
64
- if ( SwiftCore_VARIANT_MODULE_TRIPLE MATCHES ".*-([^-]+)$ " )
65
- set ( platform " ${CMAKE_MATCH_1} " )
66
- else ( )
67
- message ( FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_VARIANT_MODULE_TRIPLE} " )
61
+ if (availability_platform_${platform} )
62
+ set ( SwiftCore_SWIFT_AVAILABILITY_PLATFORM "${availability_platform_ ${platform} } " )
63
+ else ( )
64
+ message ( FATAL_ERROR "Unknown platform ${platform} for availability" )
65
+ endif ( )
68
66
endif ()
69
67
70
- if (availability_platform_${platform} )
71
- set (SwiftCore_VARIANT_AVAILABILITY_PLATFORM "${availability_platform_${platform} }" )
72
- else ()
73
- message (FATAL_ERROR "Unknown platform ${platform} for variant availability" )
68
+ if (SwiftCore_VARIANT_MODULE_TRIPLE )
69
+ if (SwiftCore_VARIANT_MODULE_TRIPLE MATCHES ".*-([^-]+)$" )
70
+ set (platform "${CMAKE_MATCH_1} " )
71
+ else ()
72
+ message (FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_VARIANT_MODULE_TRIPLE} " )
73
+ endif ()
74
+
75
+ if (availability_platform_${platform} )
76
+ set (SwiftCore_VARIANT_AVAILABILITY_PLATFORM "${availability_platform_${platform} }" )
77
+ else ()
78
+ message (FATAL_ERROR "Unknown platform ${platform} for variant availability" )
79
+ endif ()
74
80
endif ()
75
- endif ()
81
+
82
+ endif (APPLE )
0 commit comments