cmake: only set output paths with multiple outputs
This brings cmake inline with the behaviour used for configure scripts, defined in multiple-outputs.sh. It's important because that setup hook will only set shareDocName if multiple outputs are in use (and setOutputFlags hasn't been disabled). So previously, CMAKE_INSTALL_DOCDIR would be set to $out/share/doc for single-output derivations, instead of $out/share/doc/$shareDocName, which would result in collisions. Since this hook now uses the setOutputFlags variable, I had to remove the empty assignment of it added in a714284d8b7d2dac3ed2c76670f290fe332da00c. Fixes: https://github.com/NixOS/nixpkgs/issues/82304
This commit is contained in:
parent
1421404d42
commit
be1b22538a
@ -68,6 +68,7 @@ cmakeConfigurePhase() {
|
|||||||
# nix/store directory.
|
# nix/store directory.
|
||||||
cmakeFlags="-DCMAKE_INSTALL_NAME_DIR=${!outputLib}/lib $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_NAME_DIR=${!outputLib}/lib $cmakeFlags"
|
||||||
|
|
||||||
|
if [ "$outputs" != "out" -a -n "${setOutputFlags-1}" ]; then
|
||||||
# This ensures correct paths with multiple output derivations
|
# This ensures correct paths with multiple output derivations
|
||||||
# It requires the project to use variables from GNUInstallDirs module
|
# It requires the project to use variables from GNUInstallDirs module
|
||||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
||||||
@ -78,9 +79,13 @@ cmakeConfigurePhase() {
|
|||||||
cmakeFlags="-DCMAKE_INSTALL_MANDIR=${!outputMan}/share/man $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_MANDIR=${!outputMan}/share/man $cmakeFlags"
|
||||||
cmakeFlags="-DCMAKE_INSTALL_INFODIR=${!outputInfo}/share/info $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_INFODIR=${!outputInfo}/share/info $cmakeFlags"
|
||||||
cmakeFlags="-DCMAKE_INSTALL_DOCDIR=${!outputDoc}/share/doc/${shareDocName} $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_DOCDIR=${!outputDoc}/share/doc/${shareDocName} $cmakeFlags"
|
||||||
cmakeFlags="-DCMAKE_INSTALL_LIBDIR=${!outputLib}/lib $cmakeFlags"
|
|
||||||
cmakeFlags="-DCMAKE_INSTALL_LIBEXECDIR=${!outputLib}/libexec $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_LIBEXECDIR=${!outputLib}/libexec $cmakeFlags"
|
||||||
cmakeFlags="-DCMAKE_INSTALL_LOCALEDIR=${!outputLib}/share/locale $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_LOCALEDIR=${!outputLib}/share/locale $cmakeFlags"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This output flag must always be set, unlike the others, because
|
||||||
|
# otherwise we end up with lib64.
|
||||||
|
cmakeFlags="-DCMAKE_INSTALL_LIBDIR=${!outputLib}/lib $cmakeFlags"
|
||||||
|
|
||||||
# Don’t build tests when doCheck = false
|
# Don’t build tests when doCheck = false
|
||||||
if [ -z "${doCheck-}" ]; then
|
if [ -z "${doCheck-}" ]; then
|
||||||
@ -115,7 +120,6 @@ cmakeConfigurePhase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "${dontUseCmakeConfigure-}" -a -z "${configurePhase-}" ]; then
|
if [ -z "${dontUseCmakeConfigure-}" -a -z "${configurePhase-}" ]; then
|
||||||
setOutputFlags=
|
|
||||||
configurePhase=cmakeConfigurePhase
|
configurePhase=cmakeConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user