about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/cmake
diff options
context:
space:
mode:
authorLuis G. Torres <lgtorres42@gmail.com>2015-03-23 08:54:39 -0400
committerLuis G. Torres <lgtorres42@gmail.com>2015-03-30 21:25:44 -0400
commitff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62 (patch)
tree010bd78f48c35ca1334221fd14c2f7f60b8f9c75 /pkgs/development/tools/build-managers/cmake
parent355e3e90b350edfbc5a50d3a84b1fe752300b023 (diff)
downloadnixlib-ff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62.tar
nixlib-ff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62.tar.gz
nixlib-ff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62.tar.bz2
nixlib-ff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62.tar.lz
nixlib-ff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62.tar.xz
nixlib-ff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62.tar.zst
nixlib-ff35c4a5e2df6c3b2c3a6ddcbb756112cb024e62.zip
Make cmake install libraries with full install names by default so that executables can find cmake-installed shared libraries at runtime on Darwin. Addresses #6821.
Diffstat (limited to 'pkgs/development/tools/build-managers/cmake')
-rwxr-xr-xpkgs/development/tools/build-managers/cmake/setup-hook.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
index 39052fea6cb5..670376efdcab 100755
--- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
@@ -36,6 +36,15 @@ cmakeConfigurePhase() {
         cmakeFlags="-DCMAKE_CXX_COMPILER=$crossConfig-g++ -DCMAKE_C_COMPILER=$crossConfig-gcc $cmakeFlags"
     fi
 
+    # This installs shared libraries with a fully-specified install
+    # name. By default, cmake installs shared libraries with just the
+    # basename as the install name, which means that, on Darwin, they
+    # can only be found by an executable at runtime if the shared
+    # libraries are in a system path or in the same directory as the
+    # executable. This flag makes the shared library accessible from its
+    # nix/store directory.
+    cmakeFlags="-DCMAKE_INSTALL_NAME_DIR=$prefix/lib $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"