From 8a0b016fe9746d7411e1f693943b78866c324d3c Mon Sep 17 00:00:00 2001 From: JosiahWI Date: Sat, 21 Aug 2021 07:49:07 -0500 Subject: [PATCH 1/3] use version range up to 3.9 The OLD behavior of a CMake policy is deprecated by default, so a version range can be used to set all policies to NEW on the appropriate versions. It is difficult to test this extensively, but it is unlikely to cause a problem, and could fix some bugs for people using newer versions. I picked 3.9 as the top of the version range to minimize the effects, because 3.9 will set CMP0069 to NEW, which is the focus of this commit. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6552ef70c..6120d2cc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.5...3.9) project(Irrlicht VERSION 1.9.0 From ef55fc216074b8e3a508bef4fef938535a9d4654 Mon Sep 17 00:00:00 2001 From: JosiahWI Date: Sat, 21 Aug 2021 12:20:00 -0500 Subject: [PATCH 2/3] set policies with conditional block The version range that was previously introduced has two drawbacks: it has no effect prior to version 3.12, and on older MSVC versions there is a bug that causes it to error. The conditional block solves both of this issues. --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6120d2cc2..6d05a1e90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,13 @@ -cmake_minimum_required(VERSION 3.5...3.9) +cmake_minimum_required(VERSION 3.5) + +# Policies should be set to NEW behavior whenever possible. This only sets +# policies up to version 3.9 (for the IPO policies we want) as a way to +# introduce the feature more gradually and see how it works. +if(${CMAKE_VERSION} VERSION_LESS 3.9) + cmake_policy(VERSION ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}) +else() + cmake_policy(VERSION 3.9) +endif() project(Irrlicht VERSION 1.9.0 From 5d6cb4de973bd95f029931f34a71efaed0a3e4f3 Mon Sep 17 00:00:00 2001 From: JosiahWI <41302989+JosiahWI@users.noreply.github.com> Date: Sat, 21 Aug 2021 13:05:37 -0500 Subject: [PATCH 3/3] make comment more to the point Co-authored-by: sfan5 --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d05a1e90..eb90eaba2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.5) -# Policies should be set to NEW behavior whenever possible. This only sets -# policies up to version 3.9 (for the IPO policies we want) as a way to -# introduce the feature more gradually and see how it works. +# Set policies up to 3.9 since we want to enable the IPO option if(${CMAKE_VERSION} VERSION_LESS 3.9) cmake_policy(VERSION ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}) else()