CMake: Prevent possible policy warnings

This commit is contained in:
Maarten Bent 2024-02-04 18:01:36 +01:00
parent 17b0033fc9
commit f0d2d0e748
No known key found for this signature in database
GPG key ID: 58AAEE3F4A4FD070
2 changed files with 21 additions and 0 deletions

View file

@ -59,6 +59,11 @@ if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
endif() endif()
if(POLICY CMP0057)
# Support new if() IN_LIST operator.
cmake_policy(SET CMP0057 NEW)
endif()
if(POLICY CMP0060) if(POLICY CMP0060)
# Link libraries by full path even in implicit directories. # Link libraries by full path even in implicit directories.
cmake_policy(SET CMP0060 NEW) cmake_policy(SET CMP0060 NEW)

View file

@ -1,5 +1,19 @@
@PACKAGE_INIT@ @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 # determine target from compiler, platform and library type
if(WIN32 AND NOT CYGWIN AND NOT MSYS) if(WIN32 AND NOT CYGWIN AND NOT MSYS)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
@ -137,3 +151,5 @@ if(NOT @PROJECT_NAME@_FIND_COMPONENTS)
endif() endif()
check_required_components("@PROJECT_NAME@") check_required_components("@PROJECT_NAME@")
cmake_policy(POP)