Skip to content

Commit 046a174

Browse files
committed
Add SWIFT_PLATFORMS_USING_ISYSROOT to list platforms that should be building with -isysroot
1 parent 21b91cd commit 046a174

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,9 @@ set(SWIFT_DARWIN_EMBEDDED_VARIANTS "^(iphoneos|iphonesimulator|appletvos|appletv
543543
# endif()
544544
set(SWIFT_APPLE_PLATFORMS "IOS" "IOS_SIMULATOR" "TVOS" "TVOS_SIMULATOR" "WATCHOS" "WATCHOS_SIMULATOR" "OSX")
545545

546+
# A convenient list of platforms that should use -isysroot ... when building.
547+
set(SWIFT_PLATFORMS_USING_ISYSROOT SWIFT_APPLE_PLATFORMS "FREESTANDING")
548+
546549
# Configuration flags passed to all of our invocations of gyb. Try to
547550
# avoid making up new variable names here if you can find a CMake
548551
# variable that will do the job.

cmake/modules/AddSwift.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function(_add_host_variant_c_compile_link_flags name)
9393

9494
set(_sysroot
9595
"${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
96-
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
96+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_PLATFORMS_USING_ISYSROOT)
9797
target_compile_options(${name} PRIVATE -isysroot;${_sysroot})
9898
elseif(NOT SWIFT_COMPILER_IS_MSVC_LIKE AND NOT "${_sysroot}" STREQUAL "/")
9999
target_compile_options(${name} PRIVATE --sysroot=${_sysroot})

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function(_add_target_variant_c_compile_link_flags)
9898
endif()
9999

100100
set(_sysroot "${SWIFT_SDK_${CFLAGS_SDK}_ARCH_${CFLAGS_ARCH}_PATH}")
101-
if(IS_DARWIN)
101+
if(CFLAGS_SDK IN_LIST SWIFT_PLATFORMS_USING_ISYSROOT)
102102
list(APPEND result "-isysroot" "${_sysroot}")
103103
elseif(NOT SWIFT_COMPILER_IS_MSVC_LIKE AND NOT "${_sysroot}" STREQUAL "/")
104104
list(APPEND result "--sysroot=${_sysroot}")

0 commit comments

Comments
 (0)