Skip to content

Commit f653d52

Browse files
authored
Merge pull request #5101 from modocache/cmake-add-lipo-target-sdk
[cmake] Only add lipo targets for Darwin
2 parents 66cc962 + 60edee9 commit f653d52

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,15 @@ endfunction()
373373
#
374374
# Usage:
375375
# _add_swift_lipo_target(
376+
# sdk # The name of the SDK the target was created for.
377+
# # Examples include "OSX", "IOS", "ANDROID", etc.
376378
# target # The name of the target to create
377379
# output # The file to be created by this target
378380
# source_targets... # The source targets whose outputs will be
379381
# # lipo'd into the output.
380382
# )
381-
function(_add_swift_lipo_target target output)
383+
function(_add_swift_lipo_target sdk target output)
384+
precondition(sdk MESSAGE "sdk is required")
382385
precondition(target MESSAGE "target is required")
383386
precondition(output MESSAGE "output is required")
384387

@@ -397,7 +400,8 @@ function(_add_swift_lipo_target target output)
397400
endif()
398401
endforeach()
399402

400-
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
403+
is_darwin_based_sdk("${sdk}" IS_DARWIN)
404+
if(IS_DARWIN)
401405
# Use lipo to create the final binary.
402406
add_custom_command_target(unused_var
403407
COMMAND "${LIPO}" "-create" "-output" "${output}" ${source_binaries}
@@ -1467,6 +1471,7 @@ function(add_swift_library name)
14671471
endif()
14681472

14691473
_add_swift_lipo_target(
1474+
${sdk}
14701475
${lipo_target}${unsigned}
14711476
"${UNIVERSAL_LIBRARY_NAME}${unsigned}"
14721477
${THIN_INPUT_TARGETS})
@@ -1529,6 +1534,7 @@ function(add_swift_library name)
15291534
set(UNIVERSAL_LIBRARY_NAME
15301535
"${SWIFTSTATICLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
15311536
_add_swift_lipo_target(
1537+
${sdk}
15321538
${lipo_target_static}
15331539
"${UNIVERSAL_LIBRARY_NAME}"
15341540
${THIN_INPUT_TARGETS_STATIC})

0 commit comments

Comments
 (0)