Skip to content

Commit e032658

Browse files
author
Doug Coleman
committed
[cmake] Make sure SOURCEKIT_DEPLOYMENT_OS is only set once, at the top.
Reset Darwin specific CMake variables to match the correct SDK and architecture. This is needed when cross compiling, or we'll end up with conflicting SDK and architectures. Remove unused variable SOURCEKIT_GLOBAL_DEPLOYMENT_TARGET_FLAGS.
1 parent f03ec50 commit e032658

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/SourceKit/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ configure_file(
2020
set(SOURCEKIT_DEPLOYMENT_OS "${SWIFT_HOST_VARIANT}")
2121
set(SOURCEKIT_DEPLOYMENT_TARGET "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
2222

23+
swift_is_installing_component(sourcekit-inproc SOURCEKIT_INSTALLING_INPROC)
24+
25+
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
26+
set(CMAKE_OSX_SYSROOT "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_PATH}")
27+
set(CMAKE_OSX_ARCHITECTURES "${SWIFT_HOST_VARIANT_ARCH}")
28+
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
29+
endif()
30+
2331
function(add_sourcekit_symbol_exports target_name export_file)
2432
# Makefile.rules contains special cases for different platforms.
2533
# We restrict ourselves to Darwin for the time being.
@@ -458,10 +466,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
458466
string(REGEX MATCH "[0-9]+\\.[0-9]+" SOURCEKIT_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
459467
endif()
460468

461-
# Choose a deployment OS if none was set.
462-
set(SOURCEKIT_DEPLOYMENT_OS "macosx" CACHE STRING
463-
"Deployment OS for SourceKit [macosx, iphoneos, iphonesimulator].")
464-
465469
# Sadly there are two OS naming conventions.
466470
# xcrun SDK name: macosx iphoneos iphonesimulator (+ "internal" or version)
467471
# -mOS-version-min: macosx ios ios-simulator
@@ -482,10 +486,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
482486
message(FATAL_ERROR "Can't understand SOURCEKIT_DEPLOYMENT_OS '${SOURCEKIT_DEPLOYMENT_OS}';")
483487
endif()
484488

485-
# Determine deployment flags for the C/C++ compiler and linker.
486-
set(SOURCEKIT_GLOBAL_DEPLOYMENT_TARGET_FLAGS
487-
"-m${version_min_os}-version-min=${SOURCEKIT_DEPLOYMENT_TARGET}")
488-
489489
# Add deployment target to C/C++ compiler and linker flags.
490490
# FIXME: CMAKE_OSX_DEPLOYMENT_TARGET falls over when used for iOS versions.
491491
if (XCODE)

0 commit comments

Comments
 (0)