Skip to content

Commit

Permalink
cmake: use supplied RPATH instead of guessing
Browse files Browse the repository at this point in the history
  • Loading branch information
ttuegel committed May 31, 2016
1 parent 926c929 commit 8ec5adc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkgs/development/tools/build-managers/cmake/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8ec5adc

Please sign in to comment.