Skip to content

Commit c7d9184

Browse files
committed
fix: Make build system compatible with CMake-4.0
Set CMAKE_POLICY_VERSION_MINIMUM=3.5 for our ZLIB and pybind11 build scripts and modules. Update the cmake_minimum_required syntax in the top-level CMakeLists.txt Signed-off-by: Zach Lewis <zachcanbereached@gmail.com>
1 parent d6f29f3 commit c7d9184

6 files changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/wheel_workflow.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ jobs:
147147
CIBW_BUILD: ${{ matrix.python }}
148148
CIBW_ARCHS: ${{ matrix.arch }}
149149
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
150+
CMAKE_POLICY_VERSION_MINIMUM: 3.5
150151

151152
- uses: actions/upload-artifact@v4
152153
with:
@@ -209,6 +210,7 @@ jobs:
209210
CIBW_BUILD: ${{ matrix.python }}
210211
CIBW_ARCHS: ${{ matrix.arch }}
211212
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux }}
213+
CMAKE_POLICY_VERSION_MINIMUM: 3.5
212214

213215
- uses: actions/upload-artifact@v4
214216
with:
@@ -264,6 +266,7 @@ jobs:
264266
env:
265267
CIBW_BUILD: ${{ matrix.python }}
266268
CIBW_ARCHS: ${{ matrix.arch }}
269+
CMAKE_POLICY_VERSION_MINIMUM: 3.5
267270

268271
- uses: actions/upload-artifact@v4
269272
with:
@@ -319,6 +322,7 @@ jobs:
319322
env:
320323
CIBW_BUILD: ${{ matrix.python }}
321324
CIBW_ARCHS: ${{ matrix.arch }}
325+
CMAKE_POLICY_VERSION_MINIMUM: 3.5
322326

323327
- uses: actions/upload-artifact@v4
324328
with:
@@ -374,6 +378,7 @@ jobs:
374378
env:
375379
CIBW_BUILD: ${{ matrix.python }}
376380
CIBW_ARCHS: ${{ matrix.arch }}
381+
CMAKE_POLICY_VERSION_MINIMUM: 3.5
377382

378383
- uses: actions/upload-artifact@v4
379384
with:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
###############################################################################
66
# CMake definition.
77

8-
cmake_minimum_required(VERSION 3.14)
8+
cmake_minimum_required(VERSION 3.14...4.0)
99

1010
set(CMAKE_MODULE_PATH
1111
${CMAKE_MODULE_PATH}

share/ci/scripts/multi/install_pybind11.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ set -ex
77
PYBIND11_VERSION="$1"
88
INSTALL_TARGET="$2"
99

10+
# Required for CMake-4.0+ compatibility
11+
export CMAKE_POLICY_VERSION_MINIMUM=3.5
12+
1013
git clone https://github.com/pybind/pybind11.git
1114
cd pybind11
1215

share/ci/scripts/multi/install_zlib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ ZLIB_MINOR=$(echo "${ZLIB_MAJOR_MINOR}" | cut -d. -f2-)
1313
ZLIB_PATCH=$(echo "${ZLIB_VERSION}" | cut -d. -f3-)
1414
ZLIB_VERSION_U="${ZLIB_MAJOR}.${ZLIB_MINOR}.${ZLIB_PATCH}"
1515

16+
# Required for CMake-4.0+ compatibility
17+
export CMAKE_POLICY_VERSION_MINIMUM=3.5
18+
1619
git clone https://github.com/madler/zlib
1720
cd zlib
1821

share/cmake/modules/install/InstallZLIB.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ if(NOT ZLIB_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PACKAGE
7272
# version as the cmake_minimum_required and that version has no knowledge of the policy.
7373
# Since that policy gets unset, it causes a warning with CMake 3.25+.
7474
-DCMAKE_POLICY_DEFAULT_CMP0042=NEW
75+
# Required for CMake 4.0+ compatibility
76+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
7577
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
7678
-DCMAKE_VISIBILITY_INLINES_HIDDEN=${CMAKE_VISIBILITY_INLINES_HIDDEN}
7779
-DCMAKE_POSITION_INDEPENDENT_CODE=ON

share/cmake/modules/install/Installpybind11.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ if(NOT pybind11_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PAC
4646

4747
set(pybind11_CMAKE_ARGS
4848
${pybind11_CMAKE_ARGS}
49+
# Required for CMake 4.0+ compatibility.
50+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
4951
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
5052
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
5153
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}

0 commit comments

Comments
 (0)