From 31cefa01020542528e199ec78a7cf2319a843009 Mon Sep 17 00:00:00 2001 From: Peter Heywood Date: Wed, 10 Aug 2022 13:43:35 +0100 Subject: [PATCH] Prevent CMake dev warnings in Cmake >= 3.24 due to new policy --- cmake/dependencies/devil.cmake | 7 ++++++- cmake/dependencies/glew.cmake | 4 ++++ cmake/dependencies/glm.cmake | 5 +++++ cmake/dependencies/sdl2.cmake | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cmake/dependencies/devil.cmake b/cmake/dependencies/devil.cmake index a0a6afe..1c714b7 100644 --- a/cmake/dependencies/devil.cmake +++ b/cmake/dependencies/devil.cmake @@ -1,6 +1,5 @@ # DevIL # Ensure that DevIL is available, either by finding DevIL, or by downloading DevIL if required (on windows) - if(UNIX) # On Linux, if DevIL is not available the user is instructed to install it themselves. find_package(DevIL) @@ -9,6 +8,12 @@ if(UNIX) "e.g. sudo apt install libdevil-dev") endif() elseif(WIN32) + + # As the URL method is used for download, set the policy if available + if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) + endif() + # On windows, always download manually. There are issues with find_package and multi-config generators where a release library will be found, but no debug library, which can break things. # Declare source properties FetchContent_Declare( diff --git a/cmake/dependencies/glew.cmake b/cmake/dependencies/glew.cmake index b327322..63ab99f 100644 --- a/cmake/dependencies/glew.cmake +++ b/cmake/dependencies/glew.cmake @@ -10,6 +10,10 @@ if(UNIX) "e.g. sudo apt install libglew-dev") endif () elseif(WIN32) + # As the URL method is used for download, set the policy if available + if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) + endif() # On windows, always download manually. There are issues with find_package and multi-config generators where a release library will be found, but no debug library, which can break things. # Declare source properties FetchContent_Declare( diff --git a/cmake/dependencies/glm.cmake b/cmake/dependencies/glm.cmake index caf5781..70951f7 100644 --- a/cmake/dependencies/glm.cmake +++ b/cmake/dependencies/glm.cmake @@ -5,6 +5,11 @@ if(NOT glm_FOUND) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../modules/ ${CMAKE_MODULE_PATH}) include(FetchContent) + # As the URL method is used for download, set the policy if available + if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) + endif() + # Head of master at point BugFix for NVRTC support was merged FetchContent_Declare( glm diff --git a/cmake/dependencies/sdl2.cmake b/cmake/dependencies/sdl2.cmake index a7890dd..1024044 100644 --- a/cmake/dependencies/sdl2.cmake +++ b/cmake/dependencies/sdl2.cmake @@ -10,6 +10,10 @@ if(UNIX) elseif(WIN32) # On windows, always download manually. There are issues with find_package and multi-config generators where a release library will be found, but no debug library, which can break things. # Declare source properties + # As the URL method is used for download, set the policy if available + if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) + endif() FetchContent_Declare( SDL2 URL "https://www.libsdl.org/release/SDL2-devel-2.0.12-VC.zip"