From b250ac951dfd77ad7a128180fc8514ef5151cb5c Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Fri, 18 Sep 2020 18:15:07 +0100 Subject: [PATCH] Set CMake policies for newer versions of CMake Make sure that CMP0012 is set to NEW, without which FindPython3 and FindPython2 functionality becomes broken with CMake 3.18.2 if searching by location. CMP0012 being set to OLD is also deprecated as of 3.18.3. Ensure CMP0011 is set to NEW to avoid warnings and deprecated behaviour being issued about policy push / pop with CMake 3.18.0 or newer. Signed-off-by: Paul Elliott --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac24bf41b..fdaa2f134 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,18 @@ # cmake_minimum_required(VERSION 2.8.12) + +# https://cmake.org/cmake/help/latest/policy/CMP0011.html +# Setting this policy is required in CMake >= 3.18.0, otherwise a warning is generated. The OLD +# policy setting is deprecated, and will be removed in future versions. +cmake_policy(SET CMP0011 NEW) +# https://cmake.org/cmake/help/latest/policy/CMP0012.html +# Setting the CMP0012 policy to NEW is required for FindPython3 to work with CMake 3.18.2 +# (there is a bug in this particular version), otherwise, setting the CMP0012 policy is required +# for CMake versions >= 3.18.3 otherwise a deprecated warning is generated. The OLD policy setting +# is deprecated and will be removed in future versions. +cmake_policy(SET CMP0012 NEW) + if(TEST_CPP) project("mbed TLS" C CXX) else()