CMAKE_INSTALL_<dir> can be relative or absolute path, so it is wrong to prefix CMAKE_INSTALL_PREFIX because if CMAKE_INSTALL_<dir> is set to an absolute path it will result in a malformed path with two absolute paths joined together:
The libdir and includedir should be set by either calculating the directories relative to the prefix or by using the CMAKE_INSTALL_FULL_<dir> variables from GNUInstallDirs.
The CMAKE_INSTALL_FULL_<dir> variables seem the simpler solution.
The issue was observed with Nix package manager, which sets all CMAKE_INSTALL_<dir> variables to the full path of the Nix store when building the package:
CMAKE_INSTALL_<dir>
can be relative or absolute path, so it is wrong to prefixCMAKE_INSTALL_PREFIX
because ifCMAKE_INSTALL_<dir>
is set to an absolute path it will result in a malformed path with two absolute paths joined together:The
libdir
andincludedir
should be set by either calculating the directories relative to the prefix or by using theCMAKE_INSTALL_FULL_<dir>
variables fromGNUInstallDirs
.The
CMAKE_INSTALL_FULL_<dir>
variables seem the simpler solution.The issue was observed with Nix package manager, which sets all
CMAKE_INSTALL_<dir>
variables to the full path of the Nix store when building the package: