diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2014-12-29 09:36:52 -0800 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2014-12-31 18:42:18 -0800 |
commit | 622efdd3f3e832ac34edb9f7f54bb675f0fdec13 (patch) | |
tree | c19ddbd22603261a4c563419f6cdd66ead6f8294 /CMakeLists.txt | |
parent | 6fb98d621a1b123b08f5575eb051458f13998c9d (diff) |
cmake: Add cmake PackageConfig files
This creates and installs a package version file and a package config
file. These are used by find_package with the CONFIG option, and are
roughly equivalent to pkgconfig, but is cmake specific rather than linux
specific.
v2: - Use configure_package_config_file() instead of config_file(),
which generates helper macros and resolves relative paths allowing
the entire install to be moved.
- Update WaffleConfig.cmake.in to take advantage of
configure_package_config_file()
- Use SameMajorVersion instead of AnyNewerVersion for version
compatibility. Since waffle uses apache's numbering scheme 2.0.0
should not fulfill a requirement of 1.5.0 and vice versa.
v3: - Use CMAKE_BINARY_DIR (Jordan)
- Move generation of cmake config to the same area of the cmake file
as pkgconfig
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 474d203..470cd67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,8 @@ if(waffle_build_examples) endif() # ------------------------------------------------------------------------------ -# Install packaging files: waffle.pc, FindWaffle.cmake +# Install packaging files: waffle.pc, FindWaffle.cmake, +# WaffleConfigVersion.cmake, and WaffleConfig.cmake # ------------------------------------------------------------------------------ configure_file(waffle.pc.in ${waffle_libname}.pc @ONLY) @@ -124,6 +125,30 @@ install( COMPONENT cmakefind ) +set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/Waffle") +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfigVersion.cmake" + VERSION "${waffle_version}" + COMPATIBILITY SameMajorVersion +) + +configure_package_config_file( + cmake/Modules/WaffleConfig.cmake.in + cmake/Modules/WaffleConfig.cmake + INSTALL_DESTINATION "${ConfigPackageLocation}" + PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR + NO_CHECK_REQUIRED_COMPONENTS_MACRO +) + +install( + FILES + "${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfigVersion.cmake" + "${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfig.cmake" + DESTINATION "${ConfigPackageLocation}" + COMPONENT devel +) + # ------------------------------------------------------------------------------ # Install core documentation # ------------------------------------------------------------------------------ |