mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
RPATH: Record support for $ORIGIN on various *BSD
All of NetBSD, FreeBSD, OpenBSD and DragonFly BSD support `$ORIGIN`,
but the last two require `-z origin` as documented at
https://lekensteyn.nl/rpath.html
The `-z origin` option causes a flag bit to be set and has no effect if
the `RPATH` does not contain expandable tokens.
This commit is contained in:
@@ -3,3 +3,7 @@
|
||||
# see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361
|
||||
|
||||
include(Platform/FreeBSD)
|
||||
|
||||
# DragonFly BSD requires -z origin to enable $ORIGIN expansion in RPATH.
|
||||
# This is not required for FreeBSD since 10.2-RELEASE.
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-z,origin,-rpath,")
|
||||
|
||||
@@ -6,6 +6,8 @@ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
|
||||
# Does not require -z origin since 10.2-RELEASE
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
|
||||
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
|
||||
|
||||
@@ -6,6 +6,7 @@ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
|
||||
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
|
||||
|
||||
@@ -15,6 +15,10 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
|
||||
"${LDCONFIG_HINTS}")
|
||||
endif()
|
||||
|
||||
# OpenBSD requires -z origin to enable $ORIGIN expansion in RPATH.
|
||||
# This is not required for NetBSD.
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-z,origin,-rpath,")
|
||||
|
||||
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
|
||||
|
||||
# OpenBSD has no multilib
|
||||
|
||||
Reference in New Issue
Block a user