distinguish binaries install directory from cmake package file install one
Specifying a different install directory for binaries and cmake package file is technically possible through specially crafting the CMakeLists.txt file for the project but it's not straightforward nor documented.
Yet I think that these are two really different artifacts and thus, when someone builds a project (its own or third-party one) it should be able, by default, to specify different paths with only a cmake variable:
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
-
CMAKE_INSTALL_LIBDIR
and CMAKE_INSTALL_PACKAGE
One obvious advantage would be to have a special directory (a kind of registry) that receives all the cmake package files make it easier to reference them for find_package
(only one variable to set for all the library, or it could be derived from an environment variable).
A user could also set only CMAKE_INSTALL_PREFIX
which will give the same behavior as today (cmake package files in the project install/libs directory
) or set CMAKE_INSTALL_PREFIX
for the target directories (binaries and headers) and CMAKE_INSTALL_PACKAGE
separately for the cmake package "registry".