From df6bb223e4a60a71bb755084079c5925f9428699 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Fri, 6 Dec 2024 18:32:19 +0100 Subject: [PATCH] [INFRA] Remove workarounds for older CMake versions --- CMakeLists.txt | 17 +++----- .../add_include_dependencies.cmake | 10 ++--- test/cmake/seqan3_path_longest_stem.cmake | 10 +---- test/external_project/CMakeLists.txt | 42 ++++++++----------- .../seqan3_installed/CMakeLists.txt | 7 +--- .../seqan3_setup_tutorial/CMakeLists.txt | 6 +-- .../CMakeLists.txt | 6 +-- .../CMakeLists.txt | 7 +--- .../CMakeLists.txt | 7 +--- .../CMakeLists.txt | 6 +-- 10 files changed, 36 insertions(+), 82 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b95295eb8..9a1c867e4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,18 +13,11 @@ list (APPEND CMAKE_MODULE_PATH "${SEQAN3_MODULE_PATH}") include (seqan3-config-version) -if (CMAKE_VERSION VERSION_LESS 3.12) - project (seqan3 - LANGUAGES CXX - VERSION "${SEQAN3_PROJECT_VERSION}") -else () - project (seqan3 - LANGUAGES CXX - VERSION "${SEQAN3_PROJECT_VERSION}" - DESCRIPTION "SeqAn3 -- the modern C++ library for sequence analysis" # since cmake 3.9 - HOMEPAGE_URL "https://github.com/seqan/seqan3" # since cmake 3.12 - ) -endif () +project (seqan3 + LANGUAGES CXX + VERSION "${SEQAN3_PROJECT_VERSION}" + DESCRIPTION "SeqAn3 -- the modern C++ library for sequence analysis" + HOMEPAGE_URL "https://github.com/seqan/seqan3") find_package (SeqAn3 3.0 REQUIRED HINTS ${SEQAN3_MODULE_PATH}) diff --git a/test/cmake/include_dependencies/add_include_dependencies.cmake b/test/cmake/include_dependencies/add_include_dependencies.cmake index 4950a9ef59..abb00998e5 100644 --- a/test/cmake/include_dependencies/add_include_dependencies.cmake +++ b/test/cmake/include_dependencies/add_include_dependencies.cmake @@ -56,13 +56,9 @@ function (add_include_dependencies target target_cyclic_depending_includes) return () endif () - # in cmake 3.20 they changed the way how the dependency files are generated, - # we can for now re-enable the old behaviour by setting this config. - if (NOT CMAKE_VERSION VERSION_LESS 3.20) # cmake >= 3.20 - if (NOT (DEFINED CMAKE_DEPENDS_USE_COMPILER) OR CMAKE_DEPENDS_USE_COMPILER) - message (FATAL_ERROR "Starting with CMake 3.20, you need to specify -DCMAKE_DEPENDS_USE_COMPILER=OFF when " - "using -DSEQAN3_USE_INCLUDE_DEPENDENCIES=ON.") - endif () + if (NOT (DEFINED CMAKE_DEPENDS_USE_COMPILER) OR CMAKE_DEPENDS_USE_COMPILER) + message (FATAL_ERROR "Starting with CMake 3.20, you need to specify -DCMAKE_DEPENDS_USE_COMPILER=OFF when " + "using -DSEQAN3_USE_INCLUDE_DEPENDENCIES=ON.") endif () get_include_target (include_target TARGET "${target}") diff --git a/test/cmake/seqan3_path_longest_stem.cmake b/test/cmake/seqan3_path_longest_stem.cmake index e073417884..20b0969198 100644 --- a/test/cmake/seqan3_path_longest_stem.cmake +++ b/test/cmake/seqan3_path_longest_stem.cmake @@ -4,15 +4,7 @@ # A compatible function for cmake < 3.20 that basically returns `cmake_path (GET STEM LAST_ONLY )` function (seqan3_path_longest_stem out_var filename) - if (CMAKE_VERSION VERSION_LESS 3.20) # cmake < 3.20 - get_filename_component (result "${filename}" NAME) - if (result MATCHES "\\.") - string (REGEX REPLACE "(.+)[.].*" "\\1" result "${result}") - endif () - else () # cmake >= 3.20 - cmake_path (GET filename STEM LAST_ONLY result) - endif () - + cmake_path (GET filename STEM LAST_ONLY result) set ("${out_var}" "${result}" PARENT_SCOPE) # out-var diff --git a/test/external_project/CMakeLists.txt b/test/external_project/CMakeLists.txt index 2001151edb..c6b0bacee6 100644 --- a/test/external_project/CMakeLists.txt +++ b/test/external_project/CMakeLists.txt @@ -10,10 +10,8 @@ include (ExternalProject) set (SEQAN3_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../") -if (NOT ${CMAKE_VERSION} VERSION_LESS 3.14) # cmake 3.14 version is needed to install seqan3. - include (install-seqan3.cmake) - include (install-sharg.cmake) -endif () +include (install-seqan3.cmake) +include (install-sharg.cmake) option (SEQAN3_EXTERNAL_PROJECT_FIND_DEBUG_MODE "Enable this option if you want to get a detailed list which paths were considered for find_package(...)" false) @@ -72,16 +70,14 @@ ExternalProject_Add ( # We need CMake >= 3.14 to be able to package seqan3, but we actually expect that this # test works with CMake >= 3.5. # (ExternalProject_Add simulates a fresh and separate invocation of cmake ../) -if (NOT ${CMAKE_VERSION} VERSION_LESS 3.14) # cmake 3.14 version is needed to install seqan3. - ExternalProject_Add ( - seqan3_installed - PREFIX seqan3_installed - SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/seqan3_installed" - CMAKE_ARGS ${SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS} - "-DCMAKE_FIND_DEBUG_MODE=${SEQAN3_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" - "-DCMAKE_SYSTEM_PREFIX_PATH=${SEQAN3_SYSTEM_PREFIX}") - add_dependencies (seqan3_installed seqan3_test_prerequisite) -endif () +ExternalProject_Add ( + seqan3_installed + PREFIX seqan3_installed + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/seqan3_installed" + CMAKE_ARGS ${SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS} + "-DCMAKE_FIND_DEBUG_MODE=${SEQAN3_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" + "-DCMAKE_SYSTEM_PREFIX_PATH=${SEQAN3_SYSTEM_PREFIX}") +add_dependencies (seqan3_installed seqan3_test_prerequisite) # 4) This tests test/external_project/seqan3_fetch_content_zip/CMakeLists.txt # It uses fetch_content (a CMake 3.14 feature) to download our zip-release (e.g. zip, tar.xz) from @@ -90,16 +86,14 @@ endif () # Note that FetchContent is a CMake >= 3.14 feature. # This is expected to work with CMake >= 3.14. # (ExternalProject_Add simulates a fresh and separate invocation of cmake ../) -if (NOT ${CMAKE_VERSION} VERSION_LESS 3.14) # cmake 3.14 version is needed to use fetch_content. - ExternalProject_Add ( - seqan3_fetch_content_zip - PREFIX seqan3_fetch_content_zip - SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/seqan3_fetch_content_zip" - CMAKE_ARGS ${SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS} - "-DCMAKE_FIND_DEBUG_MODE=${SEQAN3_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" - "-DSEQAN3_PACKAGE_ZIP_URL=${SEQAN3_PACKAGE_ZIP_URL}") - add_dependencies (seqan3_fetch_content_zip seqan3_test_prerequisite) -endif () +ExternalProject_Add ( + seqan3_fetch_content_zip + PREFIX seqan3_fetch_content_zip + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/seqan3_fetch_content_zip" + CMAKE_ARGS ${SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS} + "-DCMAKE_FIND_DEBUG_MODE=${SEQAN3_EXTERNAL_PROJECT_FIND_DEBUG_MODE}" + "-DSEQAN3_PACKAGE_ZIP_URL=${SEQAN3_PACKAGE_ZIP_URL}") +add_dependencies (seqan3_fetch_content_zip seqan3_test_prerequisite) # 5) This test is the same as 2) but emulates the settings within the setup tutorial. # This test is used as snippet in the setup tutorial. diff --git a/test/external_project/seqan3_installed/CMakeLists.txt b/test/external_project/seqan3_installed/CMakeLists.txt index 7b613598c1..42eaf0ec5d 100644 --- a/test/external_project/seqan3_installed/CMakeLists.txt +++ b/test/external_project/seqan3_installed/CMakeLists.txt @@ -15,8 +15,5 @@ find_package (seqan3 3.0 REQUIRED) # build app with seqan3 add_executable (hello_world ../src/hello_world.cpp) target_link_libraries (hello_world seqan3::seqan3) -if (CMAKE_VERSION VERSION_LESS 3.14) - install (TARGETS hello_world RUNTIME DESTINATION bin) -else () - install (TARGETS hello_world) # RUNTIME DESTINATION not needed anymore since cmake 3.14 -endif () + +install (TARGETS hello_world) diff --git a/test/external_project/seqan3_setup_tutorial/CMakeLists.txt b/test/external_project/seqan3_setup_tutorial/CMakeLists.txt index f177b63b00..10386cd59a 100644 --- a/test/external_project/seqan3_setup_tutorial/CMakeLists.txt +++ b/test/external_project/seqan3_setup_tutorial/CMakeLists.txt @@ -31,8 +31,4 @@ add_executable (another_program another_program.cpp) target_link_libraries (another_program seqan3::seqan3) ## [adding_files] -if (CMAKE_VERSION VERSION_LESS 3.14) - install (TARGETS hello_world another_program RUNTIME DESTINATION bin) -else () - install (TARGETS hello_world another_program) # RUNTIME DESTINATION not needed anymore since cmake 3.14 -endif () +install (TARGETS hello_world another_program) diff --git a/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt b/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt index 521ad49fbc..1742748dfb 100644 --- a/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt +++ b/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt @@ -36,8 +36,4 @@ add_executable (another_program another_program.cpp) target_link_libraries (another_program seqan3::seqan3 sharg::sharg) ## [adding_files] -if (CMAKE_VERSION VERSION_LESS 3.14) - install (TARGETS hello_world another_program RUNTIME DESTINATION bin) -else () - install (TARGETS hello_world another_program) # RUNTIME DESTINATION not needed anymore since cmake 3.14 -endif () +install (TARGETS hello_world another_program) diff --git a/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt b/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt index 2c47463947..53d03e905d 100644 --- a/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt +++ b/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt @@ -16,8 +16,5 @@ find_package (sharg 1.0 REQUIRED) # build app with seqan3 add_executable (hello_world ../src/hello_world.cpp) target_link_libraries (hello_world seqan3::seqan3 sharg::sharg) -if (CMAKE_VERSION VERSION_LESS 3.14) - install (TARGETS hello_world RUNTIME DESTINATION bin) -else () - install (TARGETS hello_world) # RUNTIME DESTINATION not needed anymore since cmake 3.14 -endif () + +install (TARGETS hello_world) diff --git a/test/external_project/seqan3_submodule_add_subdirectory/CMakeLists.txt b/test/external_project/seqan3_submodule_add_subdirectory/CMakeLists.txt index 6af582c57c..e734347dc4 100644 --- a/test/external_project/seqan3_submodule_add_subdirectory/CMakeLists.txt +++ b/test/external_project/seqan3_submodule_add_subdirectory/CMakeLists.txt @@ -16,8 +16,5 @@ add_subdirectory ("${SEQAN3_ROOT}" "seqan3_build") # build app with seqan3 add_executable (hello_world ../src/hello_world.cpp) target_link_libraries (hello_world seqan3::seqan3) -if (CMAKE_VERSION VERSION_LESS 3.14) - install (TARGETS hello_world RUNTIME DESTINATION bin) -else () - install (TARGETS hello_world) # RUNTIME DESTINATION not needed anymore since cmake 3.14 -endif () + +install (TARGETS hello_world) diff --git a/test/external_project/seqan3_submodule_find_package/CMakeLists.txt b/test/external_project/seqan3_submodule_find_package/CMakeLists.txt index a31ad0cb8b..1f6e849f3c 100644 --- a/test/external_project/seqan3_submodule_find_package/CMakeLists.txt +++ b/test/external_project/seqan3_submodule_find_package/CMakeLists.txt @@ -18,8 +18,4 @@ find_package (seqan3 3.0 REQUIRED) # build app with seqan3 add_executable (hello_world ../src/hello_world.cpp) target_link_libraries (hello_world seqan3::seqan3) -if (CMAKE_VERSION VERSION_LESS 3.14) - install (TARGETS hello_world RUNTIME DESTINATION bin) -else () - install (TARGETS hello_world) # RUNTIME DESTINATION not needed anymore since cmake 3.14 -endif () +install (TARGETS hello_world)