From f6249dab1936f1285a6ca85b8322db6e1ec10560 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Tue, 30 Aug 2022 09:31:25 +0900 Subject: [PATCH] CMake: Set CMP0135 to NEW Also cleans up how the policies are set and ensures all the NEW policies also have `CMAKE_POLICY_DEFAULT_CMP` set to `NEW`. --- CMakeLists.txt | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c872e119..b86743938 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,11 @@ cmake_minimum_required(VERSION 3.13) -if(POLICY CMP0092) - cmake_policy(SET CMP0092 NEW) -endif() -if(POLICY CMP0083) - cmake_policy(SET CMP0083 NEW) -endif() -if(POLICY CMP0111) - cmake_policy(SET CMP0111 NEW) -endif() -if(POLICY CMP0126) - cmake_policy(SET CMP0126 NEW) -endif() +foreach(_policy CMP0083 CMP0092 CMP0111 CMP0126 CMP0135) + if(POLICY ${_policy}) + cmake_policy(SET ${_policy} NEW) + set(CMAKE_POLICY_DEFAULT_${_policy} NEW) + endif() +endforeach() # Projects added via `add_subdirectory` or `FetchContent` may have a lower # `cmake_minimum_required` than we set here. Set policies that we require