git.iko.soy/typeable/nixpkgs
on master help sign in
cmake: use multiple outputs for GNUInstallDirs

CMake contains a module for more granular installation directories: https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html Let’s set the paths so that projects using the module can be more easily split into multiple outputs.

commitc0d2f924590918b0176aaf1f84ccf372ce4f13c4 authorJan Tojnar <jtojnar@gmail.com> dateTue 25 Dec 2018, 20:35 (8 years ago) parent3b19fa9
1 file changed+13−1
pkgs/development/tools/build-managers/cmake/setup-hook.sh+13−1
pkgs/development/tools/build-managers/cmake/setup-hook.sh+13−1
@@ -68,8 +68,20 @@ cmakeConfigurePhase() {
6868 # executable. This flag makes the shared library accessible from its
6969 # nix/store directory.
7070 cmakeFlags="-DCMAKE_INSTALL_NAME_DIR=${!outputLib}/lib $cmakeFlags"
71+
72+ # This ensures correct paths with multiple output derivations
73+ # It requires the project to use variables from GNUInstallDirs module
74+ # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
75+ cmakeFlags="-DCMAKE_INSTALL_BINDIR=${!outputBin}/bin $cmakeFlags"
76+ cmakeFlags="-DCMAKE_INSTALL_SBINDIR=${!outputBin}/sbin $cmakeFlags"
77+ cmakeFlags="-DCMAKE_INSTALL_INCLUDEDIR=${!outputInclude}/include $cmakeFlags"
78+ cmakeFlags="-DCMAKE_INSTALL_OLDINCLUDEDIR=${!outputInclude}/include $cmakeFlags"
79+ cmakeFlags="-DCMAKE_INSTALL_MANDIR=${!outputMan}/share/man $cmakeFlags"
80+ cmakeFlags="-DCMAKE_INSTALL_INFODIR=${!outputInfo}/share/info $cmakeFlags"
81+ cmakeFlags="-DCMAKE_INSTALL_DOCDIR=${!outputDoc}/share/doc/${shareDocName} $cmakeFlags"
7182 cmakeFlags="-DCMAKE_INSTALL_LIBDIR=${!outputLib}/lib $cmakeFlags"
72− cmakeFlags="-DCMAKE_INSTALL_INCLUDEDIR=${!outputDev}/include $cmakeFlags"
83+ cmakeFlags="-DCMAKE_INSTALL_LIBEXECDIR=${!outputLib}/libexec $cmakeFlags"
84+ cmakeFlags="-DCMAKE_INSTALL_LOCALEDIR=${!outputLib}/share/locale $cmakeFlags"
7385
7486 # Avoid cmake resetting the rpath of binaries, on make install
7587 # And build always Release, to ensure optimisation flags