Skip to content

Commit 323c1c1

Browse files
authored
build: Support for CMake 4.0 (#1960)
The tricky part is that several dependencies break because of cmake 4.0 dropping support for strict compatbility with cmake < 3.5. Have to resort to some trickery with CMAKE_POLICY_VERSION_MINIMUM overriding what those packages declare via their own cmake_minimum_required(), and hope it works. Signed-off-by: Larry Gritz <[email protected]>
1 parent 9948e58 commit 323c1c1

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ OSL requires the following dependencies or tools.
2020
NEW or CHANGED dependencies since the last major release are **bold**.
2121

2222
* Build system: [CMake](https://cmake.org/) **3.19 or newer** (tested
23-
through 3.31)
23+
through 4.0)
2424

2525
* A suitable C++17 compiler to build OSL itself, which may be any of:
2626
- **GCC 9.3** or newer (tested through gcc 13.1)

src/build-scripts/build_opencolorio.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ OPENCOLORIO_CMAKE_FLAGS+=" -DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
2626
-DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_PYGLUE=OFF \
2727
-DOCIO_BUILD_JAVA=OFF \
2828
-DBUILD_SHARED_LIBS=${OPENCOLORIO_BUILD_SHARED_LIBS:=ON}"
29+
30+
# Fix yaml-cpp which breaks against cmake 4.0 because of too-old cmake min.
31+
# Remove when yaml-cpp is fixed to declare its own minimum high enough.
32+
export CMAKE_POLICY_VERSION_MINIMUM=3.5
33+
2934
BASEDIR=`pwd`
3035
pwd
3136
echo "OpenColorIO install dir will be: ${OPENCOLORIO_INSTALL_DIR}"

src/build-scripts/build_pybind11.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
2222
PYBIND11_INSTALL_DIR=${PYBIND11_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
2323
#PYBIND11_BUILD_OPTS=${PYBIND11_BUILD_OPTS:=}
2424

25+
# Fix for pybind11 breaking against cmake 4.0 because of too-old cmake min.
26+
# Remove when pybind11 is fixed to declare its own minimum high enough.
27+
export CMAKE_POLICY_VERSION_MINIMUM=3.5
28+
2529
if [[ "${PYTHON_VERSION}" != "" ]] ; then
2630
PYBIND11_BUILD_OPTS+=" -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION}"
2731
fi

src/build-scripts/build_zlib.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ ZLIB_BUILD_DIR=${ZLIB_BUILD_DIR:=${ZLIB_SRC_DIR}/build}
2121
ZLIB_INSTALL_DIR=${ZLIB_INSTALL_DIR:=${PWD}/ext/dist}
2222
#ZLIB_CONFIG_OPTS=${ZLIB_CONFIG_OPTS:=}
2323

24+
# Fix zlib which breaks against cmake 4.0 because of too-old cmake min.
25+
# Remove when zlib is fixed to declare its own minimum high enough.
26+
export CMAKE_POLICY_VERSION_MINIMUM=3.5
27+
2428
pwd
2529
echo "zlib install dir will be: ${ZLIB_INSTALL_DIR}"
2630

0 commit comments

Comments
 (0)