Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions Sources/swift-driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,18 @@ target_link_libraries(swift-driver PUBLIC
SwiftDriver
SwiftDriverExecution)

# This is a fairly egregious workaround for the fact that in versions < 3.17,
# executables do not get `-rpath` linker arguments for their linked library
# dependencies (direct and transitive)
if(CMAKE_VERSION VERSION_LESS 3.17)
get_target_property(TSC_UTIL_LIB TSCUtility LOCATION)
get_filename_component(TSC_LIB_DIR ${TSC_UTIL_LIB} DIRECTORY)

get_target_property(LLBUILD_LIB llbuildSwift LOCATION)
get_filename_component(LLBUILD_LIB_DIR ${LLBUILD_LIB} DIRECTORY)

get_target_property(ARGPARSE_LIB ArgumentParser LOCATION)
get_filename_component(ARGPARSE_LIB_DIR ${ARGPARSE_LIB} DIRECTORY)

target_link_options(swift-driver PUBLIC "LINKER:-rpath,${CMAKE_LIBRARY_OUTPUT_DIRECTORY},-rpath,${TSC_LIB_DIR},-rpath,${LLBUILD_LIB_DIR},-rpath,${ARGPARSE_LIB_DIR}")
endif()
12 changes: 12 additions & 0 deletions Sources/swift-help/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ target_link_libraries(swift-help PUBLIC
ArgumentParser
TSCBasic)

# This is a fairly egregious workaround for the fact that in versions < 3.17,
# executables do not get `-rpath` linker arguments for their linked library
# dependencies (direct and transitive)
if(CMAKE_VERSION VERSION_LESS 3.17)
get_target_property(TSC_UTIL_LIB TSCUtility LOCATION)
get_filename_component(TSC_LIB_DIR ${TSC_UTIL_LIB} DIRECTORY)

get_target_property(ARGPARSE_LIB ArgumentParser LOCATION)
get_filename_component(ARGPARSE_LIB_DIR ${ARGPARSE_LIB} DIRECTORY)

target_link_options(swift-help PUBLIC "LINKER:-rpath,${CMAKE_LIBRARY_OUTPUT_DIRECTORY},-rpath,${TSC_LIB_DIR},-rpath,${ARGPARSE_LIB_DIR}")
endif()