aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-08-10 16:35:21 +0000
committerGerald Combs <gerald@wireshark.org>2017-08-10 20:29:58 +0000
commit55dd9b16d5c9f3641bcb236282fb06983df1a5dd (patch)
tree7de076817bcde5ec2192c0548033bfbb0ce85b5c /CMakeLists.txt
parentd619a4239e3d4bc5b1f7d4829aad87004db37c07 (diff)
CMake: Update RPATH during installation.
If we're installing into a non-system prefix on UNIX or Linux, make sure CMake updates our RPATHs accordingly. Change-Id: Ia6eaa6533c996a8228cff25e9d2032b223781681 Reviewed-on: https://code.wireshark.org/review/23040 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa8e74871e..f4c27ebcac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,9 +182,19 @@ if(NOT LIBRARY_OUTPUT_PATH)
"Single output directory for building all libraries.")
endif()
-# Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
+# Under Linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
#Defines CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATADIR, etc ...
include(CMakeInstallDirs)
+# Make sure our executables can can load our libraries if we install into
+# a non-default directory on UNIX/Linux.
+# https://cmake.org/Wiki/CMake_RPATH_handling
+if(NOT (WIN32 OR APPLE))
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" IS_SYSTEM_DIR)
+ if("${IS_SYSTEM_DIR}" STREQUAL "-1")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+ endif("${IS_SYSTEM_DIR}" STREQUAL "-1")
+endif()
# Banner shown at top right of Qt welcome screen.
if(DEFINED ENV{WIRESHARK_VERSION_FLAVOR})