Add CMAKE_INSTALL_CMAKECONFDIR to GNUInstallDirs
In CMake projects, the installation directory of CMake configuration files (<package>Config.cmake
and <package>ConfigVersion.cmake
) and exported target files is typically hard-coded to a given location (as done for example in https://cmake.org/cmake/help/v3.12/manual/cmake-packages.7.html#creating-packages) or are exposed using a cache variable with a project specific name.
This complicates the job of anyone that wants to make sure that a group of packages install their cmake configuration files in a given location (see for example the vcpkg issue https://github.com/Microsoft/vcpkg/issues/77). To give CMake authors a standard way of installing CMake configuration files while allowing users to manually specify this location, I think it would be convenient if we could add a CMAKE_INSTALL_CMAKECONFDIR
variable to the variables created by the GNUInstallDirs
module, to indicate the directory in which CMake configuration files are installed.
The corresponding documentation would be:
# ``CMAKECONFDIR``
# CMake package configuration files (``LIBDIR/cmake/PROJECT_NAME``)
Suggestion for better names for the variable are highly welcome.
One possible downside is that cmakeconfdir
is not a directory listed in the GNU Coding standards
, but I think we can avoid any confusion by clearly state in the GNUInstallDirs
docs which variable are actually based on the GNU Coding standards and which one are just a "CMake extension" .
It this idea sounds reasonable, I would be happy to provide a merge request with the necessary changes to CMake, the tests and the related documentation.