commit 2667b2cd63d4783f8e9a1012d7b2c236659e7e13
parent 75e3f8dff4083bb4c2bc952606e5bd497e9557b2
Author: Robbert van der Helm <mail@robbertvanderhelm.nl>
Date: Thu, 3 Nov 2022 15:26:56 +0100
Generate a CMake package version file
This uses the version just added to the CMake project so consumers of
this library can check which version of the headers they're including.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -21,6 +21,13 @@ install(DIRECTORY "include/clap" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(TARGETS clap EXPORT clap INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(EXPORT clap DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/clap" FILE "clap-config.cmake")
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/clap-config-version.cmake"
+ VERSION "${PROJECT_VERSION}"
+ COMPATIBILITY AnyNewerVersion)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/clap-config-version.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/clap")
+
# clap-tests should always be available, to avoid build failing here and there
# because the target doesn't exists
add_custom_target(clap-tests)