Home:ALL Converter>Should I install .cmake files to share/cmake or lib/cmake?

Should I install .cmake files to share/cmake or lib/cmake?

Ask Time:2020-01-04T18:32:16         Author:einpoklum

Json Formatter

In the answer to this question:

Where should cmake files be installed?

we learn that, among other places, it is "acceptable" (in terms of CMake's search patterns) to install .cmake files under <prefix>/share/ (perhaps in additional subdirs within) or to <prefix>/lib/cmake.

Now, on the one hand, the accepted answer there suggests a preference for <prefix>/lib/cmake; but on the other hand, CMake itself, as bundled by most (?) Linux distributions, places its .cmake files under /usr/share/cmake.

So which option is preferable? Or rather, which is the most commonly-used to your knowledge?

PS - If you use GNUInstallDirs, the choice is between ${CMAKE_INSTALL_LIBDIR}/cmake vs ${CMAKE_INSTALL_DATADIR}/cmake, which is perhaps more multi-platformy.

Author:einpoklum,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59589874/should-i-install-cmake-files-to-share-cmake-or-lib-cmake
yy