From e8f668d89c5d800979032e82511dcc40b54b8492 Mon Sep 17 00:00:00 2001 From: Tessil Date: Sun, 22 Sep 2024 11:33:29 +0100 Subject: [PATCH] Bump cmake_minimum_required version to 3.5 --- CMakeLists.txt | 69 ++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16dd766..ec6fadd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(tsl-sparse-map VERSION 0.6.2 LANGUAGES CXX) include(GNUInstallDirs) @@ -26,52 +26,49 @@ endif() -# Installation (only compatible with CMake version >= 3.3) -if(${CMAKE_VERSION} VERSION_GREATER "3.2") - include(CMakePackageConfigHelpers) +include(CMakePackageConfigHelpers) - ## Install include directory and potential natvis file - install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/tsl" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +## Install include directory and potential natvis file +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/tsl" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") - if(MSVC) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/tsl-sparse-map.natvis" - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}") - endif() +if(MSVC) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/tsl-sparse-map.natvis" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}") +endif() - ## Create and install tsl-sparse-mapConfig.cmake - configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/tsl-sparse-mapConfig.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfig.cmake" - INSTALL_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map") +## Create and install tsl-sparse-mapConfig.cmake +configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/tsl-sparse-mapConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfig.cmake" - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfig.cmake" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map") - ## Create and install tsl-sparse-mapTargets.cmake - install(TARGETS sparse_map - EXPORT tsl-sparse-mapTargets) +## Create and install tsl-sparse-mapTargets.cmake +install(TARGETS sparse_map + EXPORT tsl-sparse-mapTargets) - install(EXPORT tsl-sparse-mapTargets - NAMESPACE tsl:: - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map") +install(EXPORT tsl-sparse-mapTargets + NAMESPACE tsl:: + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map") - ## Create and install tsl-sparse-mapConfigVersion.cmake - # tsl-sparse-map is header-only and does not depend on the architecture. - # Remove CMAKE_SIZEOF_VOID_P from tsl-sparse-mapConfigVersion.cmake so that a - # tsl-sparse-mapConfig.cmake generated for a 64 bit target can be used for 32 bit - # targets and vice versa. - set(CMAKE_SIZEOF_VOID_P_BACKUP ${CMAKE_SIZEOF_VOID_P}) - unset(CMAKE_SIZEOF_VOID_P) - write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfigVersion.cmake" - COMPATIBILITY SameMajorVersion) - set(CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P_BACKUP}) +## Create and install tsl-sparse-mapConfigVersion.cmake +# tsl-sparse-map is header-only and does not depend on the architecture. +# Remove CMAKE_SIZEOF_VOID_P from tsl-sparse-mapConfigVersion.cmake so that a +# tsl-sparse-mapConfig.cmake generated for a 64 bit target can be used for 32 bit +# targets and vice versa. +set(CMAKE_SIZEOF_VOID_P_BACKUP ${CMAKE_SIZEOF_VOID_P}) +unset(CMAKE_SIZEOF_VOID_P) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfigVersion.cmake" + COMPATIBILITY SameMajorVersion) +set(CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P_BACKUP}) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfigVersion.cmake" - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map") -endif() +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tsl-sparse-mapConfigVersion.cmake" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cmake/tsl-sparse-map")