From dc31c27982d642235902de296779c686bbe4448a Mon Sep 17 00:00:00 2001 From: Dominik Charousset Date: Fri, 17 Feb 2023 10:30:23 +0100 Subject: [PATCH 1/2] Write a version file for the CMake package --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f05caf213..f4f50dad5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,9 @@ else() endif() SET(INCLUDE_INSTALL_DIR include) include(CMakePackageConfigHelpers) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/hiredis-config-version.cmake" + VERSION ${VERSION} + COMPATIBILITY SameMajorVersion) configure_package_config_file(hiredis-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/hiredis-config.cmake INSTALL_DESTINATION ${CMAKE_CONF_INSTALL_DIR} PATH_VARS INCLUDE_INSTALL_DIR) @@ -164,6 +167,7 @@ INSTALL(EXPORT hiredis-targets DESTINATION ${CMAKE_CONF_INSTALL_DIR}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hiredis-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/hiredis-config-version.cmake DESTINATION ${CMAKE_CONF_INSTALL_DIR}) From 8d59429975c67609a45b0bb72527f2fbf5056a6d Mon Sep 17 00:00:00 2001 From: Dominik Charousset Date: Fri, 24 Feb 2023 17:29:43 +0100 Subject: [PATCH 2/2] Drop redundant argument > If no VERSION is given, the PROJECT_VERSION variable is used. Since we set the project version to `${VERSION}`, we can safely skip passing it to `write_basic_package_version_file` as well. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4f50dad5..37804a8d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,7 +155,6 @@ endif() SET(INCLUDE_INSTALL_DIR include) include(CMakePackageConfigHelpers) write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/hiredis-config-version.cmake" - VERSION ${VERSION} COMPATIBILITY SameMajorVersion) configure_package_config_file(hiredis-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/hiredis-config.cmake INSTALL_DESTINATION ${CMAKE_CONF_INSTALL_DIR}