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 <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner
2025-07-25 10:09:07 -04:00
committed by GitHub
parent e351ddd522
commit bb9bd85e3b
9 changed files with 17 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
name: Quick CMake config name: Quick CMake config
description: "Runs CMake 3.10+ (if already setup)" description: "Runs CMake 3.14+ (if already setup)"
inputs: inputs:
args: args:
description: "Other arguments" description: "Other arguments"

View File

@@ -265,36 +265,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Check CMake 3.10 - name: Check CMake 3.14
uses: ./.github/actions/quick_cmake uses: ./.github/actions/quick_cmake
with: with:
cmake-version: "3.10" cmake-version: "3.14"
if: success() || failure()
- name: Check CMake 3.11
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.11"
if: success() || failure()
- name: Check CMake 3.12
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.12"
if: success() || failure()
- name: Check CMake 3.13
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.13"
if: success() || failure()
- name: Check CMake 3.14.7
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.14.7"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.15 - name: Check CMake 3.15
uses: ./.github/actions/quick_cmake uses: ./.github/actions/quick_cmake
@@ -318,7 +293,6 @@ jobs:
uses: ./.github/actions/quick_cmake uses: ./.github/actions/quick_cmake
with: with:
cmake-version: "3.17" cmake-version: "3.17"
if: success() || failure()
- name: Check CMake 3.18 - name: Check CMake 3.18
uses: ./.github/actions/quick_cmake uses: ./.github/actions/quick_cmake

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10...4.0) cmake_minimum_required(VERSION 3.14...4.0)
# Note: this is a header only library. If you have an older CMake than 3.10, # Note: this is a header only library. If you have an older CMake than 3.14,
# just add the CLI11/include directory and that's all you need to do. # just add the CLI11/include directory and that's all you need to do.
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"") set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
@@ -39,16 +39,13 @@ endif()
include(CMakeDependentOption) include(CMakeDependentOption)
include(GNUInstallDirs) include(GNUInstallDirs)
if(NOT CMAKE_VERSION VERSION_LESS 3.11) include(FetchContent)
include(FetchContent)
endif()
list(APPEND force-libcxx "CMAKE_CXX_COMPILER_ID STREQUAL \"Clang\"") list(APPEND force-libcxx "CMAKE_CXX_COMPILER_ID STREQUAL \"Clang\"")
list(APPEND force-libcxx "CMAKE_SYSTEM_NAME STREQUAL \"Linux\"") list(APPEND force-libcxx "CMAKE_SYSTEM_NAME STREQUAL \"Linux\"")
list(APPEND force-libcxx "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME") list(APPEND force-libcxx "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME")
list(APPEND build-docs "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME") list(APPEND build-docs "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME")
list(APPEND build-docs "NOT CMAKE_VERSION VERSION_LESS 3.11")
list(APPEND build-docs "Doxygen_FOUND") list(APPEND build-docs "Doxygen_FOUND")
# Necessary to support paths with spaces, see #457 # Necessary to support paths with spaces, see #457

View File

@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.11...3.31) cmake_minimum_required(VERSION 3.14...4.0)
project(CLI11_Examples LANGUAGES CXX) project(CLI11_Examples LANGUAGES CXX)
# Using CMake 3.11's ability to set imported interface targets # Using CMake ability to set imported interface targets
add_library(CLI11::CLI11 IMPORTED INTERFACE) add_library(CLI11::CLI11 IMPORTED INTERFACE)
target_include_directories(CLI11::CLI11 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../../include") target_include_directories(CLI11::CLI11 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../../include")
target_compile_features(CLI11::CLI11 INTERFACE cxx_std_11) target_compile_features(CLI11::CLI11 INTERFACE cxx_std_11)

View File

@@ -32,6 +32,4 @@ target_compile_options(
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${unix-warnings} $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:${unix-warnings}
$<$<BOOL:${CLI11_WARNINGS_AS_ERRORS}>:-Werror>>) $<$<BOOL:${CLI11_WARNINGS_AS_ERRORS}>:-Werror>>)
if(NOT CMAKE_VERSION VERSION_LESS 3.13) target_link_options(CLI11_warnings INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++>)
target_link_options(CLI11_warnings INTERFACE $<$<BOOL:${CLI11_FORCE_LIBCXX}>:-stdlib=libc++>)
endif()

View File

@@ -1,16 +1,9 @@
if(CLI11_SINGLE_FILE) if(CLI11_SINGLE_FILE)
# Single file test # Single file test
if(CMAKE_VERSION VERSION_LESS 3.12) find_package(
find_package(PythonInterp REQUIRED) Python
add_executable(Python::Interpreter IMPORTED) COMPONENTS Interpreter
set_target_properties(Python::Interpreter PROPERTIES IMPORTED_LOCATION "${PYTHON_EXECUTABLE}" REQUIRED)
VERSION "${PYTHON_VERSION_STRING}")
else()
find_package(
Python
COMPONENTS Interpreter
REQUIRED)
endif()
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/single-include") file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/single-include")
add_custom_command( add_custom_command(

View File

@@ -1,4 +1,4 @@
if(CLI11_SANITIZERS AND ${CMAKE_VERSION} VERSION_GREATER "3.15.0") if(CLI11_SANITIZERS AND ${CMAKE_VERSION} VERSION_GREATER "3.15")
message(STATUS "Using arsenm/sanitizers-cmake") message(STATUS "Using arsenm/sanitizers-cmake")
FetchContent_Declare( FetchContent_Declare(
sanitizers sanitizers
@@ -320,7 +320,7 @@ if(CLI11_INSTALL_PACKAGE_TESTS)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/find_package_tests") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/find_package_tests")
if(MSVC AND ${CMAKE_VERSION} VERSION_GREATER 3.12.9) if(MSVC)
# Tests for other CMake projects including and using CLI11 using find_package # Tests for other CMake projects including and using CLI11 using find_package
add_test( add_test(
NAME find-package-testsA NAME find-package-testsA

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10...3.26) cmake_minimum_required(VERSION 3.14...4.0)
project(CLI11-find-package-test) project(CLI11-find-package-test)

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10...3.26) cmake_minimum_required(VERSION 3.14...4.0)
project(CLI11-package-config-test) project(CLI11-package-config-test)