Skip to content

Commit

Permalink
fix: increase min CMake to 3.5 (#898)
Browse files Browse the repository at this point in the history
CMake 3.27 will start warning if this is older than 3.5.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored Jun 28, 2023
1 parent 77722ac commit f07a8cc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .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.4+ (if already setup)"
description: "Runs CMake 3.5+ (if already setup)"
inputs:
args:
description: "Other arguments"
Expand All @@ -13,7 +13,7 @@ runs:
using: composite
steps:
- name: CMake ${{ inputs.cmake-version }}
uses: jwlawson/actions-setup-cmake@v1.13
uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "${{ inputs.cmake-version }}"
- run: |
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Check CMake 3.4
with:
cmake-version: "3.4"
uses: ./.github/actions/quick_cmake

- name: Check CMake 3.5
uses: ./.github/actions/quick_cmake
with:
Expand Down Expand Up @@ -265,22 +260,34 @@ jobs:
cmake-version: "3.22"
if: success() || failure()

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

- name: Check CMake 3.24 (full)
- name: Check CMake 3.24
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.24"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()

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

- name: Check CMake 3.26 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.26"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()

- name: Check CMake 3.27 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.27"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
cmake_minimum_required(VERSION 3.4)
# Note: this is a header only library. If you have an older CMake than 3.4,
cmake_minimum_required(VERSION 3.5)
# 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.4 to 3.24) version
# Make sure users don't get warnings on a tested (3.5 to 3.26) version
# of CMake. For most of the policies, the new version is better (hence the change).
# We don't use the 3.4...3.24 syntax because of a bug in an older MSVC's
# We don't use the 3.5...3.26 syntax because of a bug in an older MSVC's
# built-in and modified CMake 3.11
if(${CMAKE_VERSION} VERSION_LESS 3.25)
if(${CMAKE_VERSION} VERSION_LESS 3.26)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.25)
cmake_policy(VERSION 3.26)
endif()

set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ To use, there are several methods:
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, use `include_directories(/opt/CLI11)`
point at this folder. With CMake 3.5+, use `include_directories(/opt/CLI11)`
- Local headers and target: Use `CLI/*.hpp` files. You could check out the
repository as a git submodule, for example. With CMake, you can use
`add_subdirectory` and the `CLI11::CLI11` interface target when linking. If
Expand Down
5 changes: 3 additions & 2 deletions book/chapters/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include shown above.

### CMake support for the full edition

If you use CMake 3.4+ for your project (highly recommended), CLI11 comes with a
If you use CMake 3.5+ for your project (highly recommended), CLI11 comes with a
powerful CMakeLists.txt file that was designed to also be used with
`add_subproject`. You can add the repository to your code (preferably as a git
submodule), then add the following line to your project (assuming your folder is
Expand All @@ -43,7 +43,8 @@ You can also configure and optionally install CLI11, and CMake will create the
necessary `lib/cmake/CLI11/CLI11Config.cmake` files, so
`find_package(CLI11 CONFIG REQUIRED)` also works.

If you use conan.io, CLI11 supports that too.
If you use conan.io, CLI11 supports that too. CLI11 also supports Meson and
pkg-config if you are not using CMake.

### Running tests on the full edition

Expand Down

0 comments on commit f07a8cc

Please sign in to comment.