Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmake): upgrade maximum supported CMake version to 3.27 #4786

Merged
merged 10 commits into from
Dec 14, 2023
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ endif()

cmake_minimum_required(VERSION 3.5)
henryiii marked this conversation as resolved.
Show resolved Hide resolved

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

if(_pybind11_cmp0148)
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/embedding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ information, see :doc:`/compiling`.

.. code-block:: cmake

cmake_minimum_required(VERSION 3.5...3.26)
cmake_minimum_required(VERSION 3.5...3.27)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating all these is a good idea, though. :)

project(example)

find_package(pybind11 REQUIRED) # or `add_subdirectory(pybind11)`
Expand Down
6 changes: 3 additions & 3 deletions docs/compiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ extension module can be created with just a few lines of code:

.. code-block:: cmake

cmake_minimum_required(VERSION 3.5...3.26)
cmake_minimum_required(VERSION 3.5...3.27)
project(example LANGUAGES CXX)

add_subdirectory(pybind11)
Expand Down Expand Up @@ -498,7 +498,7 @@ You can use these targets to build complex applications. For example, the

.. code-block:: cmake

cmake_minimum_required(VERSION 3.5...3.26)
cmake_minimum_required(VERSION 3.5...3.27)
project(example LANGUAGES CXX)

find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
Expand Down Expand Up @@ -556,7 +556,7 @@ information about usage in C++, see :doc:`/advanced/embedding`.

.. code-block:: cmake

cmake_minimum_required(VERSION 3.5...3.26)
cmake_minimum_required(VERSION 3.5...3.27)
project(example LANGUAGES CXX)

find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
Expand Down
6 changes: 3 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

cmake_minimum_required(VERSION 3.5)

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

# Filter out items; print an optional message if any items filtered. This ignores extensions.
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cmake_build/installed_embed/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.5)

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

project(test_installed_embed CXX)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cmake_build/installed_function/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.5)
project(test_installed_module CXX)

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

project(test_installed_function CXX)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cmake_build/installed_target/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.5)

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

project(test_installed_target CXX)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.5)

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

project(test_subdirectory_embed CXX)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cmake_build/subdirectory_function/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.5)

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

project(test_subdirectory_function CXX)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cmake_build/subdirectory_target/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.5)

# The `cmake_minimum_required(VERSION 3.5...3.26)` syntax does not work with
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
# the behavior using the following workaround:
if(${CMAKE_VERSION} VERSION_LESS 3.26)
if(${CMAKE_VERSION} VERSION_LESS 3.27)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.26)
cmake_policy(VERSION 3.27)
endif()

project(test_subdirectory_target CXX)
Expand Down
Loading