From 7a2860bf703fc5648eac9e3695b813ecd23b39d8 Mon Sep 17 00:00:00 2001 From: Russel Waters Date: Wed, 12 Feb 2020 09:42:51 -0500 Subject: [PATCH] guard policy setting by version checks (#2550) * guard policy setting by version checks greater or equal short explainations of policies being set --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48a1d5e3..ce27035e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,13 @@ cmake_minimum_required (VERSION 3.4) -cmake_policy(SET CMP0074 NEW) -cmake_policy(SET CMP0077 NEW) +if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12") + #find_package uses _ROOT variables + cmake_policy(SET CMP0074 NEW) +endif() +if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13") + #option honors normal variables + cmake_policy(SET CMP0077 NEW) +endif() # compatibility for osx sierra and on # needs to be set before project set (CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "")