Skip to content

Commit

Permalink
feat: increase min CMake to 3.10
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Nov 9, 2024
1 parent a68a48b commit 8f28706
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/actions/quick_cmake/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Quick CMake config
description: "Runs CMake 3.5+ (if already setup)"
description: "Runs CMake 3.10+ (if already setup)"
inputs:
args:
description: "Other arguments"
Expand Down
40 changes: 8 additions & 32 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,36 +238,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Check CMake 3.5
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.5"
if: success() || failure()

- name: Check CMake 3.6
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.6"
if: success() || failure()

- name: Check CMake 3.7
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.7"
if: success() || failure()

- name: Check CMake 3.8
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.8"
if: success() || failure()

- name: Check CMake 3.9
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.9"
if: success() || failure()

- name: Check CMake 3.10
uses: ./.github/actions/quick_cmake
with:
Expand Down Expand Up @@ -390,15 +360,21 @@ jobs:
cmake-version: "3.28.X"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()

- name: Check CMake 3.29
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.29"
if: success() || failure()

- name: Check CMake 3.30
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.30"
if: success() || failure()

- name: Check CMake 3.31
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.31"
if: success() || failure()
16 changes: 2 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10...3.31)
# Note: this is a header only library. If you have an older CMake than 3.5,
# just add the CLI11/include directory and that's all you need to do.

# Make sure users don't get warnings on a tested (3.5 to 3.30) version
# of CMake. For most of the policies, the new version is better (hence the change).
# We don't use the 3.5...3.30 syntax because of a bug in an older MSVC's
# built-in and modified CMake 3.11
if(${CMAKE_VERSION} VERSION_LESS 3.30)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.30)
endif()

set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")

# Read in the line containing the version
Expand All @@ -35,9 +25,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)

find_package(Doxygen)

if(CMAKE_VERSION VERSION_LESS 3.10)
message(STATUS "CMake 3.10+ adds Doxygen support. Update CMake to build documentation")
elseif(NOT Doxygen_FOUND)
if(NOT Doxygen_FOUND)
message(STATUS "Doxygen not found, building docs has been disabled")
endif()

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ details are available at [installation][]:
separately.
- All-in-one global header: Like above, but copying the file to a shared folder
location like `/opt/CLI11`. Then, the C++ include path has to be extended to
point at this folder. With CMake 3.5+, use `include_directories(/opt/CLI11)`
point at this folder. With CMake 3.10+, use `include_directories(/opt/CLI11)`
- For other methods including using CMake, conan or vcpkg and some specific
instructions for GCC 8 or WASI see [installation][].

Expand Down
2 changes: 1 addition & 1 deletion book/code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.11...3.31)

project(CLI11_Examples LANGUAGES CXX)

Expand Down
16 changes: 1 addition & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,7 @@ target_include_directories(
$<INSTALL_INTERFACE:include>)

if(CMAKE_CXX_STANDARD LESS 14)
if(CMAKE_VERSION VERSION_LESS 3.8)
# This might not be a complete list
target_compile_features(
CLI11
INTERFACE cxx_lambdas
cxx_nullptr
cxx_override
cxx_range_for
cxx_right_angle_brackets
cxx_strong_enums
cxx_constexpr
cxx_auto_type)
else()
target_compile_features(CLI11 INTERFACE cxx_std_11)
endif()
target_compile_features(CLI11 INTERFACE cxx_std_11)
endif()

if(CLI11_INSTALL)
Expand Down

0 comments on commit 8f28706

Please sign in to comment.