Skip to content

Add -z,origin linker flag on OpenBSD. #5196

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ else()
"/clang:-fcf-runtime-abi=swift")
endif()

set(CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH ON)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD|DragonFlyBSD")
add_link_options("LINKER:-z,origin")
endif()

if(CMAKE_BUILD_TYPE STREQUAL Debug)
list(APPEND _Foundation_common_build_flags
"-DDEBUG")
Expand Down
4 changes: 0 additions & 4 deletions Sources/Foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ if(NOT BUILD_SHARED_LIBS)
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
endif()

set_target_properties(Foundation PROPERTIES
INSTALL_RPATH "$ORIGIN"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)

if(dispatch_FOUND)
set_target_properties(Foundation PROPERTIES
BUILD_RPATH "$<TARGET_FILE_DIR:swiftDispatch>")
Expand Down
4 changes: 0 additions & 4 deletions Sources/FoundationNetworking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ if(NOT BUILD_SHARED_LIBS)

endif()

set_target_properties(FoundationNetworking PROPERTIES
INSTALL_RPATH "$ORIGIN"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)

if(LINKER_SUPPORTS_BUILD_ID)
target_link_options(FoundationNetworking PRIVATE "LINKER:--build-id=sha1")
endif()
Expand Down
4 changes: 0 additions & 4 deletions Sources/FoundationXML/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ if(NOT BUILD_SHARED_LIBS)

endif()

set_target_properties(FoundationXML PROPERTIES
INSTALL_RPATH "$ORIGIN"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)

if(LINKER_SUPPORTS_BUILD_ID)
target_link_options(FoundationXML PRIVATE "LINKER:--build-id=sha1")
endif()
Expand Down
3 changes: 1 addition & 2 deletions Sources/plutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ target_link_libraries(plutil PRIVATE
Foundation)

set_target_properties(plutil PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib/swift/${SWIFT_SYSTEM_NAME}"
INSTALL_REMOVE_ENVIRONMENT_RPATH ON)
INSTALL_RPATH "$ORIGIN/../lib/swift/${SWIFT_SYSTEM_NAME}")

set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS plutil)
install(TARGETS plutil
Expand Down