From 3aeab2f13519ef101822adc2c6590d3084f450fe Mon Sep 17 00:00:00 2001 From: David Cattermole Date: Sun, 16 Jun 2024 11:38:52 +1000 Subject: [PATCH] CMake 3.23 and below compatibility. The build would fail with CMake 3.17 (for example), because CMake Policy CMP0135 did not exist in CMake 3.23 and below. --- CMakeLists.txt | 12 +++++++----- lib/CMakeLists.txt | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c2e401f..ed7862b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,11 +38,13 @@ cmake_policy(SET CMP0048 NEW) # https://cmake.org/cmake/help/latest/policy/CMP0063.html cmake_policy(SET CMP0063 NEW) -# Changes how timestamps of downloaded files with -# ExternalProject_Add() are set. -# -# https://cmake.org/cmake/help/latest/policy/CMP0135.html -cmake_policy(SET CMP0135 NEW) +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + # Changes how timestamps of downloaded files with + # ExternalProject_Add() are set. + # + # https://cmake.org/cmake/help/latest/policy/CMP0135.html + cmake_policy(SET CMP0135 NEW) +endif() # Do not allow using GNU extensions (such as '-std=g++11'), because # it's not compatible with Maya. diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 589ff017..0e48db82 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -32,11 +32,13 @@ cmake_policy(SET CMP0048 NEW) # # https://cmake.org/cmake/help/latest/policy/CMP0063.html # cmake_policy(SET CMP0063 NEW) -# Changes how timestamps of downloaded files with -# ExternalProject_Add() are set. -# -# https://cmake.org/cmake/help/latest/policy/CMP0135.html -cmake_policy(SET CMP0135 NEW) +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + # Changes how timestamps of downloaded files with + # ExternalProject_Add() are set. + # + # https://cmake.org/cmake/help/latest/policy/CMP0135.html + cmake_policy(SET CMP0135 NEW) +endif() # Do not allow using GNU extensions (such as '-std=g++11'), because # it's not compatible with Maya.