From 4c33b91fe98d5383c391b5ac2a1b2c990519dd6c Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 10 Jun 2022 15:44:04 +0200 Subject: [PATCH] Write ghc_filesystem-config-version.cmake file CMakeLists.txt: Write a ghc_filesystem-config-version.cmake file and install it, so that other projects may rely on the exact version of ghc_filesystem. The compatibility mode implies, that any version of ghc_filesystem with the same major version is feature compatible. --- CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff712e1..8995f26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,16 @@ if(GHC_FILESYSTEM_WITH_INSTALL) "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem" PATH_VARS CMAKE_INSTALL_INCLUDEDIR) - install(FILES "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem") + write_basic_package_version_file( + "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion + ) + install( + FILES + "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake" + "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem" + ) add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem) endif()