Skip to content

Commit b7aca2b

Browse files
authored
Merge pull request swiftlang#21462 from compnerd/build-host-target
build: differentiate better between host and target
2 parents da32ae6 + c764e8a commit b7aca2b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ set(swift_core_link_flags "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
220220
set(swift_core_framework_depends)
221221
set(swift_core_private_link_libraries)
222222
set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}")
223-
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
223+
if(SWIFT_PRIMARY_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
224224
list(APPEND swift_core_link_flags "-all_load")
225225
list(APPEND swift_core_framework_depends Foundation)
226226
list(APPEND swift_core_framework_depends CoreFoundation)
@@ -238,24 +238,21 @@ else()
238238
#set(LINK_FLAGS
239239
# -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive)
240240
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "")
241-
list(APPEND swift_core_private_link_libraries
242-
ICU_UC ICU_I18N)
241+
list(APPEND swift_core_private_link_libraries ICU_UC ICU_I18N)
243242
else()
244243
list(APPEND swift_core_private_link_libraries -licui18nswift -licuucswift -licudataswift)
245244
endif()
246245
endif()
247246

248247
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
249-
execute_process(COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT}"
250-
OUTPUT_VARIABLE ENV_SYSTEMROOT)
251-
252-
list(APPEND swift_core_link_flags "${ENV_SYSTEMROOT}/system32/psapi.dll")
248+
# TODO(compnerd) cache this variable to permit re-configuration
249+
execute_process(COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT}" OUTPUT_VARIABLE ENV_SYSTEMROOT)
250+
list(APPEND swift_core_private_link_libraries "${ENV_SYSTEMROOT}/system32/psapi.dll")
253251
endif()
254252

255-
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
253+
if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL FREEBSD)
256254
find_library(EXECINFO_LIBRARY execinfo)
257-
list(APPEND swift_core_private_link_libraries
258-
${EXECINFO_LIBRARY})
255+
list(APPEND swift_core_private_link_libraries ${EXECINFO_LIBRARY})
259256
endif()
260257

261258
option(SWIFT_CHECK_ESSENTIAL_STDLIB
@@ -280,7 +277,7 @@ endif()
280277

281278

282279
set(shared_only_libs)
283-
if(SWIFT_BUILD_STATIC_STDLIB AND "${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
280+
if(SWIFT_BUILD_STATIC_STDLIB AND "${SWIFT_PRIMARY_VARIANT_SDK}" STREQUAL "LINUX")
284281
list(APPEND swift_core_private_link_libraries swiftImageInspectionShared)
285282
endif()
286283

0 commit comments

Comments
 (0)