From f0d2d0e748bfc65c8d8ce134c0bd055b19415c7a Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Feb 2024 18:01:36 +0100 Subject: [PATCH] CMake: Prevent possible policy warnings --- build/cmake/policies.cmake | 5 +++++ build/cmake/wxWidgetsConfig.cmake.in | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/build/cmake/policies.cmake b/build/cmake/policies.cmake index 9ea1d995c0..997a0b3350 100644 --- a/build/cmake/policies.cmake +++ b/build/cmake/policies.cmake @@ -59,6 +59,11 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() +if(POLICY CMP0057) + # Support new if() IN_LIST operator. + cmake_policy(SET CMP0057 NEW) +endif() + if(POLICY CMP0060) # Link libraries by full path even in implicit directories. cmake_policy(SET CMP0060 NEW) diff --git a/build/cmake/wxWidgetsConfig.cmake.in b/build/cmake/wxWidgetsConfig.cmake.in index 85e3e004bd..a174bfd9b5 100644 --- a/build/cmake/wxWidgetsConfig.cmake.in +++ b/build/cmake/wxWidgetsConfig.cmake.in @@ -1,5 +1,19 @@ @PACKAGE_INIT@ +cmake_policy(PUSH) +# Set policies to prevent warnings +if(POLICY CMP0057) + # Support new if() IN_LIST operator. + cmake_policy(SET CMP0057 NEW) +endif() +if(POLICY CMP0072) + # FindOpenGL prefers GLVND by default when available. + cmake_policy(GET CMP0072 _OpenGL_GL_POLICY) + if (_OpenGL_GL_POLICY STREQUAL "") + cmake_policy(SET CMP0072 NEW) + endif() +endif() + # determine target from compiler, platform and library type if(WIN32 AND NOT CYGWIN AND NOT MSYS) if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) @@ -137,3 +151,5 @@ if(NOT @PROJECT_NAME@_FIND_COMPONENTS) endif() check_required_components("@PROJECT_NAME@") + +cmake_policy(POP)