From c1e6569f13b05a21188c083c24338a4b7bb362fe Mon Sep 17 00:00:00 2001 From: Alexandre Bouvier Date: Sat, 14 Aug 2021 19:20:37 +0200 Subject: [PATCH] fix cmake config files --- CMakeLists.txt | 21 +++++++++++++++------ cmake/config.cmake.in | 2 ++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2c54f1..9dfdda7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.6...3.0.2) -project(xbyak CXX) +project(xbyak LANGUAGES CXX VERSION 5.994) file(GLOB headers xbyak/*.h) @@ -18,17 +18,26 @@ if (DEFINED CMAKE_VERSION AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.2) install( TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} ) - configure_file( + include(CMakePackageConfigHelpers) + configure_package_config_file( cmake/config.cmake.in - ${PROJECT_NAME}Config.cmake - @ONLY + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + ) + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" + COMPATIBILITY SameMajorVersion ) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" + DESTINATION + ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) install( diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in index f40ebfa..6bd5004 100644 --- a/cmake/config.cmake.in +++ b/cmake/config.cmake.in @@ -1 +1,3 @@ +@PACKAGE_INIT@ + include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")