[CMake] CMake and Learning from bad examples
Brian Davis
bitminer at gmail.com
Thu Jul 27 20:48:07 EDT 2017
In latest CMake Doc for cmake modules at:
https://cmake.org/cmake/help/v3.0/module/CMakePackageConfigHelpers.html#module:CMakePackageConfigHelpers
I find:
Example using both configure_package_config_file() and
write_basic_package_version_file(): CMakeLists.txt:
set(INCLUDE_INSTALL_DIR include/ ... CACHE )
set(LIB_INSTALL_DIR lib/ ... CACHE )
set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
...
include(CMakePackageConfigHelpers)
configure_package_config_file(FooConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
PATH_VARS INCLUDE_INSTALL_DIR
SYSCONFIG_INSTALL_DIR)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
VERSION 1.2.3
COMPATIBILITY SameMajorVersion )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
Uses for the install directory
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
which leads me to beleive that install will be to
${CMAKE_INSTALL_PREIX}/lib/Foo/cmake
However lets look at where say come projects from a company called Kitware
put them:
./lib/cmake
./lib/cmake/ITK-4.8
./lib/cmake/vtk-7.0
And note the version say ITK-4.8 because if your intalling multiple
versions say old on top of new I may be a good idea not to have directories
without version info say like
lib/Foo
better might be
lib/cmake/Foo-1.2.3
but hey for documentation stating the "best practices" CMake still appears
all over the map when in comes to packages.
Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170727/8a43279b/attachment.html>
More information about the CMake
mailing list