From 5ecee0be0213e4becec497276beeea3b2ce71064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Tue, 22 Sep 2026 17:04:23 +0200 Subject: [PATCH] Adopt CMake 4.4 policies Keep CMake 3.16 as the minimum and opt into policies through 4.4. Test the latest CMake release on Linux, Windows, and macOS. --- .claude/skills/sqlitecpp-build-cmake/SKILL.md | 4 +- .github/workflows/cmake_policy_4_4.yml | 73 +++++++++++++++++++ CHANGELOG.md | 1 + CMakeLists.txt | 2 +- examples/example2/CMakeLists.txt | 2 +- tests/consumer/CMakeLists.txt | 2 +- 6 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/cmake_policy_4_4.yml diff --git a/.claude/skills/sqlitecpp-build-cmake/SKILL.md b/.claude/skills/sqlitecpp-build-cmake/SKILL.md index 009bbd88..ea04b277 100644 --- a/.claude/skills/sqlitecpp-build-cmake/SKILL.md +++ b/.claude/skills/sqlitecpp-build-cmake/SKILL.md @@ -44,5 +44,5 @@ description: Build SQLiteCpp with CMake. Use for CMake builds, tests, options, o - If the submodule is needed: `git submodule update --init --recursive`. - SQLiteCpp requires CMake 3.16 or newer and C++17 or newer. - Keep the minimum CMake version deliberate and update CMake configuration and documentation together. -- The `...4.0` policy maximum in `cmake_minimum_required` does not cap the supported CMake version; - it opts into policy behavior through CMake 4.0 while still allowing newer CMake releases. +- The `...4.4` policy maximum in `cmake_minimum_required` does not cap the supported CMake version; + it opts into policy behavior through CMake 4.4 while still allowing newer CMake releases. diff --git a/.github/workflows/cmake_policy_4_4.yml b/.github/workflows/cmake_policy_4_4.yml new file mode 100644 index 00000000..4d2c33c8 --- /dev/null +++ b/.github/workflows/cmake_policy_4_4.yml @@ -0,0 +1,73 @@ +name: Latest CMake / 4.4 policies + +on: [push, pull_request] + +jobs: + build: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - windows-latest + - macos-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/setup-python@v6 + with: + python-version: "3.x" + + - name: Install latest CMake + run: python -m pip install --upgrade cmake + + - name: Check CMake version + run: cmake --version + + - name: Configure SQLiteCpp + run: > + cmake + -S . + -B build/main + -DCMAKE_BUILD_TYPE=Debug + -DSQLITECPP_BUILD_TESTS=ON + -DSQLITECPP_BUILD_EXAMPLES=ON + -DSQLITECPP_RUN_CPPCHECK=OFF + -DSQLITECPP_RUN_CPPLINT=OFF + + - name: Build SQLiteCpp + run: cmake --build build/main --config Debug + + - name: Test SQLiteCpp + run: ctest --test-dir build/main --build-config Debug --output-on-failure + + - name: Configure C++20 consumer + run: > + cmake + -S tests/consumer + -B build/consumer + -DCMAKE_BUILD_TYPE=Debug + -DSQLITECPP_CXX_STANDARD=17 + -DCONSUMER_CXX_STANDARD=20 + + - name: Build consumer + run: cmake --build build/consumer --config Debug + + - name: Test consumer + run: ctest --test-dir build/consumer --build-config Debug --output-on-failure + + - name: Configure subdirectory example + run: > + cmake + -S examples/example2 + -B build/example2 + -DCMAKE_BUILD_TYPE=Debug + + - name: Build subdirectory example + run: cmake --build build/example2 --config Debug diff --git a/CHANGELOG.md b/CHANGELOG.md index 18756f3c..3ec3ec2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Require CMake 3.16 or newer - Require C++17 and test C++20 compatibility +- Adopt CMake 4.4 policies ## [3.4.0] - 2026-09-21 diff --git a/CMakeLists.txt b/CMakeLists.txt index 24924181..4e39a4f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt # or copy at http://opensource.org/licenses/MIT) -cmake_minimum_required(VERSION 3.16...4.0) +cmake_minimum_required(VERSION 3.16...4.4) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # custom CMake modules like FindSQLiteCpp project(SQLiteCpp VERSION 4.0.0) diff --git a/examples/example2/CMakeLists.txt b/examples/example2/CMakeLists.txt index 434c3772..add96691 100644 --- a/examples/example2/CMakeLists.txt +++ b/examples/example2/CMakeLists.txt @@ -4,7 +4,7 @@ # # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt # or copy at http://opensource.org/licenses/MIT) -cmake_minimum_required(VERSION 3.16...4.0) +cmake_minimum_required(VERSION 3.16...4.4) project(SQLiteCpp_Example VERSION 2.0) # SQLiteCpp requires a C++17 compiler diff --git a/tests/consumer/CMakeLists.txt b/tests/consumer/CMakeLists.txt index 9720a1d9..adca333e 100644 --- a/tests/consumer/CMakeLists.txt +++ b/tests/consumer/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16...4.0) +cmake_minimum_required(VERSION 3.16...4.4) project(SQLiteCpp_Consumer LANGUAGES CXX) set(SQLITECPP_CXX_STANDARD 17 CACHE STRING "C++ standard used to build SQLiteCpp")