[cmake] Support custom package install paths
authorJohn Ericson <John.Ericson@Obsidian.Systems>
Sat, 1 Jan 2022 20:18:27 +0000 (20:18 +0000)
committerJohn Ericson <John.Ericson@Obsidian.Systems>
Mon, 25 Jul 2022 21:02:53 +0000 (21:02 +0000)
commitac0d1d5c7b7e0d572e35e31e0b59be765ca42a48
tree011a54e6042ee73873dc6922908d96474fd44ade
parent8c626fc0c8a904c0040a36561edd9b62ac3b71b4
[cmake] Support custom package install paths

Firstly, we we make an additional GNUInstallDirs-style variable. With
NixOS, for example, this is crucial as we want those to go in
`${dev}/lib/cmake` not `${out}/lib/cmake` as that would a cmake subdir
of the "regular" libdir, which is installed even when no one needs to do
any development.

Secondly, we make *Config.cmake robust to absolute package install
paths. We for NixOS will in fact be passing them absolute paths to make
the `${dev}` vs `${out}` distinction mentioned above, and the
GNUInstallDirs-style variables are suposed to support absolute paths in
general so it's good practice besides the NixOS use-case.

Thirdly, we make `${project}_INSTALL_PACKAGE_DIR` CACHE PATHs like other
install dirs are.

Reviewed By: sebastian-ne

Differential Revision: https://reviews.llvm.org/D117973
clang/cmake/modules/CMakeLists.txt
cmake/Modules/FindPrefixFromConfig.cmake
cmake/Modules/GNUInstallPackageDir.cmake [new file with mode: 0644]
flang/cmake/modules/CMakeLists.txt
lld/cmake/modules/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/cmake/modules/CMakeLists.txt
mlir/cmake/modules/CMakeLists.txt
polly/cmake/CMakeLists.txt