Skip to content

[cmake] Use is_darwin_sdk over CMAKE_SYSTEM_NAME #5100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,22 @@ function(_add_variant_c_compile_link_flags)
list(APPEND result "-fms-compatibility-version=1900")
endif()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")

if(IS_DARWIN)
# Check if there's a specific iOS deployment version needed for this invocation
if("${CFLAGS_SDK}" STREQUAL "IOS" OR "${CFLAGS_SDK}" STREQUAL "IOS_SIMULATOR")
set(DEPLOYMENT_VERSION ${CFLAGS_DEPLOYMENT_VERSION_IOS})
endif()

if("${DEPLOYMENT_VERSION}" STREQUAL "")
set(DEPLOYMENT_VERSION "${SWIFT_SDK_${CFLAGS_SDK}_DEPLOYMENT_VERSION}")
endif()

list(APPEND result
"-arch" "${CFLAGS_ARCH}"
"-F" "${SWIFT_SDK_${CFLAGS_SDK}_PATH}/../../../Developer/Library/Frameworks"
"-m${SWIFT_SDK_${CFLAGS_SDK}_VERSION_MIN_NAME}-version-min=${DEPLOYMENT_VERSION}")
endif()

if(CFLAGS_ANALYZE_CODE_COVERAGE)
list(APPEND result "-fprofile-instr-generate"
"-fcoverage-mapping")
Expand Down Expand Up @@ -241,7 +240,8 @@ function(_add_variant_swift_compile_flags
"-target" "${SWIFT_SDK_${sdk}_ARCH_${arch}_TRIPLE}"
"-resource-dir" "${SWIFTLIB_DIR}")

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
is_darwin_based_sdk("${sdk}" IS_DARWIN)
if(IS_DARWIN)
list(APPEND result
"-F" "${SWIFT_SDK_${sdk}_PATH}/../../../Developer/Library/Frameworks")
endif()
Expand Down Expand Up @@ -1688,7 +1688,8 @@ function(_add_swift_executable_single name)
list(APPEND link_flags "-Wl,-no_pie")
endif()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
is_darwin_based_sdk("${SWIFTEXE_SINGLE_SDK}" IS_DARWIN)
if(IS_DARWIN)
list(APPEND link_flags
"-Xlinker" "-rpath"
"-Xlinker" "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}")
Expand Down