Skip to content

Commit bb9bd85

Browse files
authored
chore: require CMake 3.14+ (#1182)
3.15 is a good minimum these days, and what pybind11, etc. now use. (Edit: we are using some really old docker containers, so let's do 3.14+ for now). --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent e351ddd commit bb9bd85

File tree

9 files changed

+17
-55
lines changed

9 files changed

+17
-55
lines changed

.github/actions/quick_cmake/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Quick CMake config
2-
description: "Runs CMake 3.10+ (if already setup)"
2+
description: "Runs CMake 3.14+ (if already setup)"
33
inputs:
44
args:
55
description: "Other arguments"

.github/workflows/tests.yml

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -265,36 +265,11 @@ jobs:
265265
steps:
266266
- uses: actions/checkout@v4
267267

268-
- name: Check CMake 3.10
268+
- name: Check CMake 3.14
269269
uses: ./.github/actions/quick_cmake
270270
with:
271-
cmake-version: "3.10"
272-
if: success() || failure()
273-
274-
- name: Check CMake 3.11
275-
uses: ./.github/actions/quick_cmake
276-
with:
277-
cmake-version: "3.11"
278-
if: success() || failure()
279-
280-
- name: Check CMake 3.12
281-
uses: ./.github/actions/quick_cmake
282-
with:
283-
cmake-version: "3.12"
284-
if: success() || failure()
285-
286-
- name: Check CMake 3.13
287-
uses: ./.github/actions/quick_cmake
288-
with:
289-
cmake-version: "3.13"
290-
if: success() || failure()
291-
292-
- name: Check CMake 3.14.7
293-
uses: ./.github/actions/quick_cmake
294-
with:
295-
cmake-version: "3.14.7"
271+
cmake-version: "3.14"
296272
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
297-
if: success() || failure()
298273

299274
- name: Check CMake 3.15
300275
uses: ./.github/actions/quick_cmake
@@ -318,7 +293,6 @@ jobs:
318293
uses: ./.github/actions/quick_cmake
319294
with:
320295
cmake-version: "3.17"
321-
if: success() || failure()
322296

323297
- name: Check CMake 3.18
324298
uses: ./.github/actions/quick_cmake

CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cmake_minimum_required(VERSION 3.10...4.0)
2-
# Note: this is a header only library. If you have an older CMake than 3.10,
1+
cmake_minimum_required(VERSION 3.14...4.0)
2+
# Note: this is a header only library. If you have an older CMake than 3.14,
33
# just add the CLI11/include directory and that's all you need to do.
44

55
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
@@ -39,16 +39,13 @@ endif()
3939
include(CMakeDependentOption)
4040
include(GNUInstallDirs)
4141

42-
if(NOT CMAKE_VERSION VERSION_LESS 3.11)
43-
include(FetchContent)
44-
endif()
42+
include(FetchContent)
4543

4644
list(APPEND force-libcxx "CMAKE_CXX_COMPILER_ID STREQUAL \"Clang\"")
4745
list(APPEND force-libcxx "CMAKE_SYSTEM_NAME STREQUAL \"Linux\"")
4846
list(APPEND force-libcxx "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME")
4947

5048
list(APPEND build-docs "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME")
51-
list(APPEND build-docs "NOT CMAKE_VERSION VERSION_LESS 3.11")
5249
list(APPEND build-docs "Doxygen_FOUND")
5350

5451
# Necessary to support paths with spaces, see #457

book/code/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
cmake_minimum_required(VERSION 3.11...3.31)
1+
cmake_minimum_required(VERSION 3.14...4.0)
22

33
project(CLI11_Examples LANGUAGES CXX)
44

5-
# Using CMake 3.11's ability to set imported interface targets
5+
# Using CMake ability to set imported interface targets
66
add_library(CLI11::CLI11 IMPORTED INTERFACE)
77
target_include_directories(CLI11::CLI11 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../../include")
88
target_compile_features(CLI11::CLI11 INTERFACE cxx_std_11)

cmake/CLI11Warnings.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,4 @@ target_compile_options(
3232
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${unix-warnings}
3333
$<$<BOOL:${CLI11_WARNINGS_AS_ERRORS}>:-Werror>>)
3434

35-
if(NOT CMAKE_VERSION VERSION_LESS 3.13)
36-
target_link_options(CLI11_warnings INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++>)
37-
endif()
35+
target_link_options(CLI11_warnings INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++>)

single-include/CMakeLists.txt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
if(CLI11_SINGLE_FILE)
22
# Single file test
3-
if(CMAKE_VERSION VERSION_LESS 3.12)
4-
find_package(PythonInterp REQUIRED)
5-
add_executable(Python::Interpreter IMPORTED)
6-
set_target_properties(Python::Interpreter PROPERTIES IMPORTED_LOCATION "${PYTHON_EXECUTABLE}"
7-
VERSION "${PYTHON_VERSION_STRING}")
8-
else()
9-
find_package(
10-
Python
11-
COMPONENTS Interpreter
12-
REQUIRED)
13-
endif()
3+
find_package(
4+
Python
5+
COMPONENTS Interpreter
6+
REQUIRED)
147

158
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/single-include")
169
add_custom_command(

tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if(CLI11_SANITIZERS AND ${CMAKE_VERSION} VERSION_GREATER "3.15.0")
1+
if(CLI11_SANITIZERS AND ${CMAKE_VERSION} VERSION_GREATER "3.15")
22
message(STATUS "Using arsenm/sanitizers-cmake")
33
FetchContent_Declare(
44
sanitizers
@@ -320,7 +320,7 @@ if(CLI11_INSTALL_PACKAGE_TESTS)
320320

321321
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/find_package_tests")
322322

323-
if(MSVC AND ${CMAKE_VERSION} VERSION_GREATER 3.12.9)
323+
if(MSVC)
324324
# Tests for other CMake projects including and using CLI11 using find_package
325325
add_test(
326326
NAME find-package-testsA

tests/find_package_tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10...3.26)
1+
cmake_minimum_required(VERSION 3.14...4.0)
22

33
project(CLI11-find-package-test)
44

tests/package_config_tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10...3.26)
1+
cmake_minimum_required(VERSION 3.14...4.0)
22

33
project(CLI11-package-config-test)
44

0 commit comments

Comments
 (0)