Skip to content

Commit b250ac9

Browse files
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 <[email protected]>
1 parent d9d4e80 commit b250ac9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@
2121
#
2222

2323
cmake_minimum_required(VERSION 2.8.12)
24+
25+
# https://cmake.org/cmake/help/latest/policy/CMP0011.html
26+
# Setting this policy is required in CMake >= 3.18.0, otherwise a warning is generated. The OLD
27+
# policy setting is deprecated, and will be removed in future versions.
28+
cmake_policy(SET CMP0011 NEW)
29+
# https://cmake.org/cmake/help/latest/policy/CMP0012.html
30+
# Setting the CMP0012 policy to NEW is required for FindPython3 to work with CMake 3.18.2
31+
# (there is a bug in this particular version), otherwise, setting the CMP0012 policy is required
32+
# for CMake versions >= 3.18.3 otherwise a deprecated warning is generated. The OLD policy setting
33+
# is deprecated and will be removed in future versions.
34+
cmake_policy(SET CMP0012 NEW)
35+
2436
if(TEST_CPP)
2537
project("mbed TLS" C CXX)
2638
else()

0 commit comments

Comments
 (0)