From e44aae2268d4bc32719f35fddd2b33cee558ed85 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 15 Jan 2026 12:38:45 -0500 Subject: [PATCH] chore: bump CMake max policy to 4.2 (#5944) * chore: bupm CMake to 4.1 Signed-off-by: Henry Schreiner * ci: use newest version of CMake in a few places Signed-off-by: Henry Schreiner * chore: bupm CMake to 4.2 Signed-off-by: Henry Schreiner --------- Signed-off-by: Henry Schreiner --- .github/workflows/configure.yml | 4 ++-- CMakeLists.txt | 2 +- docs/advanced/embedding.rst | 2 +- docs/compiling.rst | 10 +++++----- tests/CMakeLists.txt | 2 +- tests/test_cmake_build/installed_embed/CMakeLists.txt | 2 +- .../test_cmake_build/installed_function/CMakeLists.txt | 2 +- tests/test_cmake_build/installed_target/CMakeLists.txt | 2 +- .../test_cmake_build/subdirectory_embed/CMakeLists.txt | 2 +- .../subdirectory_function/CMakeLists.txt | 2 +- .../subdirectory_target/CMakeLists.txt | 2 +- tools/pybind11GuessPythonExtSuffix.cmake | 2 +- tools/test-pybind11GuessPythonExtSuffix.cmake | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml index cd034c883..226e3f718 100644 --- a/.github/workflows/configure.yml +++ b/.github/workflows/configure.yml @@ -39,10 +39,10 @@ jobs: cmake: "3.15" - runs-on: macos-14 - cmake: "4.0" + cmake: "4.2" - runs-on: windows-latest - cmake: "4.0" + cmake: "4.2" name: 🐍 3.11 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 806330393..097b4eba2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.27") cmake_policy(GET CMP0148 _pybind11_cmp0148) endif() -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) if(_pybind11_cmp0148) cmake_policy(SET CMP0148 ${_pybind11_cmp0148}) diff --git a/docs/advanced/embedding.rst b/docs/advanced/embedding.rst index 145471b7f..c41aec152 100644 --- a/docs/advanced/embedding.rst +++ b/docs/advanced/embedding.rst @@ -18,7 +18,7 @@ information, see :doc:`/compiling`. .. code-block:: cmake - cmake_minimum_required(VERSION 3.15...4.0) + cmake_minimum_required(VERSION 3.15...4.2) project(example) find_package(pybind11 REQUIRED) # or `add_subdirectory(pybind11)` diff --git a/docs/compiling.rst b/docs/compiling.rst index e74e3b203..b693bd587 100644 --- a/docs/compiling.rst +++ b/docs/compiling.rst @@ -18,7 +18,7 @@ A Python extension module can be created with just a few lines of code: .. code-block:: cmake - cmake_minimum_required(VERSION 3.15...4.0) + cmake_minimum_required(VERSION 3.15...4.2) project(example LANGUAGES CXX) set(PYBIND11_FINDPYTHON ON) @@ -447,7 +447,7 @@ See the `Config file`_ docstring for details of relevant CMake variables. .. code-block:: cmake - cmake_minimum_required(VERSION 3.15...4.0) + cmake_minimum_required(VERSION 3.15...4.2) project(example LANGUAGES CXX) find_package(pybind11 REQUIRED) @@ -492,7 +492,7 @@ FindPython, pybind11 will detect this and use the existing targets instead: .. code-block:: cmake - cmake_minimum_required(VERSION 3.15...4.0) + cmake_minimum_required(VERSION 3.15...4.2) project(example LANGUAGES CXX) find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED) @@ -570,7 +570,7 @@ You can use these targets to build complex applications. For example, the .. code-block:: cmake - cmake_minimum_required(VERSION 3.15...4.0) + cmake_minimum_required(VERSION 3.15...4.2) project(example LANGUAGES CXX) find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11) @@ -628,7 +628,7 @@ information about usage in C++, see :doc:`/advanced/embedding`. .. code-block:: cmake - cmake_minimum_required(VERSION 3.15...4.0) + cmake_minimum_required(VERSION 3.15...4.2) project(example LANGUAGES CXX) find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fdf33628a..275031c5d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,7 +5,7 @@ # All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) # Filter out items; print an optional message if any items filtered. This ignores extensions. # diff --git a/tests/test_cmake_build/installed_embed/CMakeLists.txt b/tests/test_cmake_build/installed_embed/CMakeLists.txt index 8561ef438..a36496655 100644 --- a/tests/test_cmake_build/installed_embed/CMakeLists.txt +++ b/tests/test_cmake_build/installed_embed/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) project(test_installed_embed CXX) diff --git a/tests/test_cmake_build/installed_function/CMakeLists.txt b/tests/test_cmake_build/installed_function/CMakeLists.txt index 8e75f86e6..d27741123 100644 --- a/tests/test_cmake_build/installed_function/CMakeLists.txt +++ b/tests/test_cmake_build/installed_function/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) project(test_installed_function CXX) diff --git a/tests/test_cmake_build/installed_target/CMakeLists.txt b/tests/test_cmake_build/installed_target/CMakeLists.txt index d8af4391b..6ee01693d 100644 --- a/tests/test_cmake_build/installed_target/CMakeLists.txt +++ b/tests/test_cmake_build/installed_target/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) project(test_installed_target CXX) diff --git a/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt b/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt index bb83a6e6e..81b445813 100644 --- a/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +++ b/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) project(test_subdirectory_embed CXX) diff --git a/tests/test_cmake_build/subdirectory_function/CMakeLists.txt b/tests/test_cmake_build/subdirectory_function/CMakeLists.txt index f35549288..10b283dee 100644 --- a/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +++ b/tests/test_cmake_build/subdirectory_function/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) project(test_subdirectory_function CXX) diff --git a/tests/test_cmake_build/subdirectory_target/CMakeLists.txt b/tests/test_cmake_build/subdirectory_target/CMakeLists.txt index aadc8c0d8..88d73f604 100644 --- a/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +++ b/tests/test_cmake_build/subdirectory_target/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) project(test_subdirectory_target CXX) diff --git a/tools/pybind11GuessPythonExtSuffix.cmake b/tools/pybind11GuessPythonExtSuffix.cmake index b8c351ef0..5c2a229f8 100644 --- a/tools/pybind11GuessPythonExtSuffix.cmake +++ b/tools/pybind11GuessPythonExtSuffix.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) function(pybind11_guess_python_module_extension python) diff --git a/tools/test-pybind11GuessPythonExtSuffix.cmake b/tools/test-pybind11GuessPythonExtSuffix.cmake index a66282db2..a9ecc29f1 100644 --- a/tools/test-pybind11GuessPythonExtSuffix.cmake +++ b/tools/test-pybind11GuessPythonExtSuffix.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...4.0) +cmake_minimum_required(VERSION 3.15...4.2) # Tests for pybind11_guess_python_module_extension # Run using `cmake -P tools/test-pybind11GuessPythonExtSuffix.cmake`