Skip to content

Commit a0e7edd

Browse files
authored
Merge pull request swiftlang#28127 from edymtt/search-in-sdkroot
Build: search libraries in Apple SDKs (if needed)
2 parents 8b3a15b + 88a046c commit a0e7edd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,14 @@ function(_add_swift_library_single target name)
12611261
"${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/../lib/swift/${SWIFTLIB_SINGLE_SUBDIR}"
12621262
"${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/../lib/swift/${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_LIB_SUBDIR}")
12631263

1264+
# In certain cases when building, the environment variable SDKROOT is set to override
1265+
# where the sdk root is located in the system. If that environment variable has been
1266+
# set by the user, respect it and add the specified SDKROOT directory to the
1267+
# library_search_directories so we are able to link against those libraries
1268+
if(DEFINED ENV{SDKROOT} AND EXISTS "$ENV{SDKROOT}/usr/lib/swift")
1269+
list(APPEND library_search_directories "$ENV{SDKROOT}/usr/lib/swift")
1270+
endif()
1271+
12641272
# Add variant-specific flags.
12651273
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
12661274
set(build_type "${SWIFT_STDLIB_BUILD_TYPE}")

0 commit comments

Comments
 (0)