Skip to content

Commit 959b3f8

Browse files
Benedikt Volkelsawenzel
authored andcommitted
Set r-path for mac correctly
1 parent e3f1edc commit 959b3f8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ SET(INSTALL_INC_DIR ${CMAKE_INSTALL_PREFIX}/include)
3232
SET(INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
3333
SET(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/cmake)
3434

35+
# setup for rpath and mac on the shoulders of O2 CMake
36+
include(GNUInstallDirs)
37+
if (APPLE)
38+
set(basePoint @loader_path)
39+
else()
40+
set(basePoint $ORIGIN)
41+
endif()
42+
set(CMAKE_SKIP_BUILD_RPATH FALSE)
43+
if (APPLE)
44+
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
45+
endif()
46+
47+
# add to the install RPATH the (automatically determined) parts of the RPATH
48+
# that point to directories outside the build tree
49+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
50+
51+
# specify libraries directory relative to binaries one.
52+
file(RELATIVE_PATH relDir ${INSTALL_BIN_DIR} ${INSTALL_LIB_DIR})
53+
set(CMAKE_INSTALL_RPATH ${basePoint} ${basePoint}/${relDir})
54+
3555
#################################
3656
# Whether or not to build tests #
3757
#################################

0 commit comments

Comments
 (0)