Skip to content

Commit

Permalink
Merge pull request #3314 from eseiler/infra/bump_cmake
Browse files Browse the repository at this point in the history
[INFRA] Bump CMake
  • Loading branch information
rrahn authored Dec 13, 2024
2 parents 29c2e98 + df6bb22 commit 2d84062
Show file tree
Hide file tree
Showing 42 changed files with 57 additions and 146 deletions.
19 changes: 6 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,18 @@
# SeqAn3. To build tests, run cmake on one of the sub-folders in this directory
# which contain a CMakeLists.txt.

cmake_minimum_required (VERSION 3.5...3.30)
cmake_minimum_required (VERSION 3.20...3.31)

find_path (SEQAN3_MODULE_PATH "seqan3-config.cmake" HINTS "${CMAKE_CURRENT_LIST_DIR}/cmake/")
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})

Expand Down
2 changes: 0 additions & 2 deletions cmake/seqan3-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
#
# ============================================================================

cmake_minimum_required (VERSION 3.5...3.30)

# ----------------------------------------------------------------------------
# Set initial variables
# ----------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions cmake/seqan3-install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# This file describes where and which parts of SeqAn3 should be installed to.

cmake_minimum_required (VERSION 3.14...3.30)

include (GNUInstallDirs)

# install documentation files in /share/doc
Expand Down
2 changes: 0 additions & 2 deletions cmake/seqan3-package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# This file describes how SeqAn3 will be packaged.

cmake_minimum_required (VERSION 3.7...3.30)

set (CPACK_GENERATOR "TXZ")

set (CPACK_PACKAGE_VERSION "${SEQAN3_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion doc/setup/quickstart_cmake/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ For example, after adding `another_program.cpp` your `CMakeLists.txt` may look l
# Including SeqAn3 as external project

```cmake
cmake_minimum_required (VERSION 3.14...3.30)
cmake_minimum_required (VERSION 3.20...3.31)
project (my_app LANGUAGES CXX VERSION 1.0.0)
Expand Down
2 changes: 1 addition & 1 deletion test/analyse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)
cmake_minimum_required (VERSION 3.20...3.31)
project (seqan3_test_analyze CXX)

include (../seqan3-test.cmake)
Expand Down
2 changes: 1 addition & 1 deletion test/api_stability/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: CC0-1.0

cmake_minimum_required (VERSION 3.8...3.30)
cmake_minimum_required (VERSION 3.20...3.31)

project (api_stability)

Expand Down
2 changes: 0 additions & 2 deletions test/cmake/add_subdirectories.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

# Calls add_subdirectory on all (direct) subdirectories of the given directory if they contain a `CMakeLists.txt`
#
# Example:
Expand Down
2 changes: 0 additions & 2 deletions test/cmake/diagnostics/list_missing_unit_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

set (seqan3_test_include_targets
""
CACHE STRING "" FORCE)
Expand Down
2 changes: 0 additions & 2 deletions test/cmake/diagnostics/list_unused_snippets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

set (seqan3_test_snippets
""
CACHE STRING "" FORCE)
Expand Down
2 changes: 0 additions & 2 deletions test/cmake/diagnostics/list_unused_unit_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

set (seqan3_test_targets
""
CACHE STRING "" FORCE)
Expand Down
12 changes: 3 additions & 9 deletions test/cmake/include_dependencies/add_include_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

include (diagnostics/list_missing_unit_tests)

# get_include_target (<VAR> TARGET dna4_test)
Expand Down Expand Up @@ -58,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}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.12...3.30)
# This line is required because this file is used in script mode (cmake -P).
cmake_minimum_required (VERSION 3.20...3.31)

function (generate_include_dependencies_impl)
cmake_parse_arguments (
Expand Down
2 changes: 0 additions & 2 deletions test/cmake/seqan3_generate_snippet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

# Generate snippets from a source_snippet
#
# Example:
Expand Down
2 changes: 0 additions & 2 deletions test/cmake/seqan3_macro_benchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

# Adds a macro benchmark target and a test which executes that macro benchmark
#
# Example:
Expand Down
12 changes: 1 addition & 11 deletions test/cmake/seqan3_path_longest_stem.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,9 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

# A compatible function for cmake < 3.20 that basically returns `cmake_path (GET <filename> STEM LAST_ONLY <out_var>)`
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
Expand Down
2 changes: 0 additions & 2 deletions test/cmake/seqan3_require_ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.15...3.30)

# This file's only purpose is to be replaced with the content of the use_ccache CMakeLists.txt file
# when creating the source package.
CPMGetPackage (use_ccache)
2 changes: 0 additions & 2 deletions test/cmake/seqan3_test_component.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

include (seqan3_path_longest_stem)

# Get a specific component of a test file which follows the seqan3 naming scheme.
Expand Down
2 changes: 0 additions & 2 deletions test/cmake/seqan3_test_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

# Finds all files relative to the `test_base_path_` which satisfy the given file pattern.
#
# Example:
Expand Down
2 changes: 1 addition & 1 deletion test/coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)
cmake_minimum_required (VERSION 3.20...3.31)
project (seqan3_test_coverage CXX)

# Add a custom build type: Coverage
Expand Down
2 changes: 1 addition & 1 deletion test/documentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: BSD-3-Clause

# Minimum cmake version
cmake_minimum_required (VERSION 3.7...3.30)
cmake_minimum_required (VERSION 3.20...3.31)

### Find seqan3
include (../../cmake/seqan3-config-version.cmake)
Expand Down
2 changes: 0 additions & 2 deletions test/documentation/seqan3-doxygen-layout.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

include (${SEQAN3_INCLUDE_DIR}/../test/cmake/seqan3_test_files.cmake)

# Replaces documentation entries in variable `DOXYGEN_LAYOUT`
Expand Down
2 changes: 0 additions & 2 deletions test/documentation/seqan3-doxygen-package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

set (CPACK_GENERATOR "TXZ")

set (CPACK_COMPONENTS_ALL doc)
Expand Down
2 changes: 0 additions & 2 deletions test/documentation/seqan3-doxygen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.10...3.30)

### Find doxygen and dependency to DOT tool
message (STATUS "Searching for doxygen.")
find_package (Doxygen REQUIRED)
Expand Down
44 changes: 19 additions & 25 deletions test/external_project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.5...3.30)
cmake_minimum_required (VERSION 3.20...3.31)
project (seqan3_test_external_project CXX)

include (../seqan3-test.cmake) # for SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS, SEQAN3_VERSION
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)
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions test/external_project/install-seqan3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.14...3.30)

# install and package seqan3 library
ExternalProject_Add (
seqan3_test_prerequisite
Expand Down
2 changes: 0 additions & 2 deletions test/external_project/install-sharg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.14...3.30)

# We can only set one CMAKE_SYSTEM_PREFIX_PATH, i.e. it cannot be a list.
# Hence we need to reuse the SEQAN3_SYSTEM_PREFIX.
if (NOT DEFINED SEQAN3_SYSTEM_PREFIX)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.14...3.30)
cmake_minimum_required (VERSION 3.20...3.31)
project (seqan3_app CXX)

# --- helper scripts
Expand Down
9 changes: 3 additions & 6 deletions test/external_project/seqan3_installed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.5...3.30)
cmake_minimum_required (VERSION 3.20...3.31)
project (seqan3_app CXX)

# --- helper scripts
Expand All @@ -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)
Loading

0 comments on commit 2d84062

Please sign in to comment.