From 8ec5adc953d6bbabbe62d7f7229f146202704e53 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 31 May 2016 06:26:22 -0500 Subject: [PATCH] cmake: use supplied RPATH instead of guessing --- .../tools/build-managers/cmake/setup-hook.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh index eaabb37f49871..adf05f1af9782 100755 --- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh +++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh @@ -47,9 +47,15 @@ cmakeConfigurePhase() { cmakeFlags="-DCMAKE_INSTALL_LIBDIR=${!outputLib}/lib $cmakeFlags" cmakeFlags="-DCMAKE_INSTALL_INCLUDEDIR=${!outputDev}/include $cmakeFlags" - # Avoid cmake resetting the rpath of binaries, on make install - # And build always Release, to ensure optimisation flags - cmakeFlags="-DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON $cmakeFlags" + # Always build Release, to ensure optimisation flags. + cmakeFlags="-DCMAKE_BUILD_TYPE=Release $cmakeFlags" + # Do not change the RPATH between build and install, simply + # build with the correct RPATH in the first place. + cmakeFlags="-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE $cmakeFlags" + # Do not try to guess the correct RPATH based on linker flags. + cmakeFlags="-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE $cmakeFlags" + # Just use exactly our RPATH. + cmakeFlags="-DCMAKE_INSTALL_RPATH=$CMAKE_INSTALL_RPATH $cmakeFlags" echo "cmake flags: $cmakeFlags ${cmakeFlagsArray[@]}" @@ -77,6 +83,7 @@ makeCmakeFindLibs(){ ;; -L*) export CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH${CMAKE_LIBRARY_PATH:+:}${flag:2}" + export CMAKE_INSTALL_RPATH="$CMAKE_INSTALL_RPATH${CMAKE_INSTALL_RPATH:+:}${flag:2}" ;; esac done