Skip to content

Commit ef14e9d

Browse files
committed
build: replace some is_darwin_sdk usage
Use the simpler inline form of the check in most places. The two sites that remain have multiple uses in a single function. It should be possible to replace those as well, though it is unclear if the overhead of inlining the check to all the places in the function will make a measurable difference.
1 parent abec87d commit ef14e9d

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,7 @@ function(_add_swift_lipo_target)
542542
list(APPEND source_binaries $<TARGET_FILE:${source_target}>)
543543
endforeach()
544544

545-
is_darwin_based_sdk("${LIPO_SDK}" IS_DARWIN)
546-
if(IS_DARWIN)
545+
if(${LIPO_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
547546
if(LIPO_CODESIGN)
548547
set(codesign_command COMMAND "codesign" "-f" "-s" "-" "${LIPO_OUTPUT}")
549548
endif()
@@ -751,8 +750,7 @@ function(_add_swift_library_single target name)
751750
endif()
752751

753752
if (SWIFT_COMPILER_VERSION)
754-
is_darwin_based_sdk("${SWIFTLIB_SINGLE_SDK}" IS_DARWIN)
755-
if(IS_DARWIN)
753+
if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
756754
list(APPEND SWIFTLIB_SINGLE_LINK_FLAGS "-Xlinker" "-current_version" "-Xlinker" "${SWIFT_COMPILER_VERSION}" "-Xlinker" "-compatibility_version" "-Xlinker" "1")
757755
endif()
758756
endif()
@@ -1014,8 +1012,7 @@ function(_add_swift_library_single target name)
10141012
endforeach()
10151013
endif()
10161014

1017-
is_darwin_based_sdk("${SWIFTLIB_SINGLE_SDK}" IS_DARWIN)
1018-
if(IS_DARWIN)
1015+
if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
10191016
set(install_name_dir "@rpath")
10201017

10211018
if(SWIFTLIB_SINGLE_IS_STDLIB)
@@ -2084,8 +2081,7 @@ function(_add_swift_executable_single name)
20842081
list(APPEND link_flags "-Wl,-no_pie")
20852082
endif()
20862083

2087-
is_darwin_based_sdk("${SWIFTEXE_SINGLE_SDK}" IS_DARWIN)
2088-
if(IS_DARWIN)
2084+
if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
20892085
list(APPEND link_flags
20902086
"-Xlinker" "-rpath"
20912087
"-Xlinker" "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}")
@@ -2227,8 +2223,7 @@ function(add_swift_target_executable name)
22272223
${SWIFTEXE_TARGET_DONT_STRIP_NON_MAIN_SYMBOLS_FLAG}
22282224
${SWIFTEXE_DISABLE_ASLR_FLAG})
22292225

2230-
is_darwin_based_sdk("${sdk}" IS_DARWIN)
2231-
if(IS_DARWIN)
2226+
if(${sdk} IN_LIST SWIFT_APPLE_PLATFORMS)
22322227
add_custom_command_target(unused_var2
22332228
COMMAND "codesign" "-f" "-s" "-" "${SWIFT_RUNTIME_OUTPUT_INTDIR}/${VARIANT_NAME}"
22342229
CUSTOM_TARGET_NAME "${VARIANT_NAME}_signed"

0 commit comments

Comments
 (0)