From f07a8cc6fb3a3b6d617544784220f081e2eacaef Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 28 Jun 2023 16:24:27 -0400 Subject: [PATCH] fix: increase min CMake to 3.5 (#898) CMake 3.27 will start warning if this is older than 3.5. Signed-off-by: Henry Schreiner --- .github/actions/quick_cmake/action.yml | 4 ++-- .github/workflows/tests.yml | 25 ++++++++++++++++--------- CMakeLists.txt | 12 ++++++------ README.md | 2 +- book/chapters/installation.md | 5 +++-- 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/actions/quick_cmake/action.yml b/.github/actions/quick_cmake/action.yml index 8359fb0d0..d2b3825fe 100644 --- a/.github/actions/quick_cmake/action.yml +++ b/.github/actions/quick_cmake/action.yml @@ -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" @@ -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: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 086ea53c2..fe2aca700 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: @@ -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() diff --git a/CMakeLists.txt b/CMakeLists.txt index cdc2011d8..21c08e51d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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]+\"(.+)\"") diff --git a/README.md b/README.md index ae263eeff..74182c7d6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/book/chapters/installation.md b/book/chapters/installation.md index c8af7dfa2..051aeddf2 100644 --- a/book/chapters/installation.md +++ b/book/chapters/installation.md @@ -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 @@ -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