From b193f9ab59d98be04e506da572e02903119a51b4 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Tue, 13 Feb 2024 15:48:33 +0100 Subject: [PATCH] [cmake] guard cmake_policy(CMP0091) only set the policy to NEW if it is defined --- CMakeLists.txt | 4 +++- client/SDL/CMakeLists.txt | 4 +++- client/Sample/CMakeLists.txt | 4 +++- cmake/CommonConfigOptions.cmake | 6 ++++-- server/proxy/modules/bitmap-filter/CMakeLists.txt | 4 +++- server/proxy/modules/demo/CMakeLists.txt | 4 +++- server/proxy/modules/dyn-channel-dump/CMakeLists.txt | 4 +++- winpr/CMakeLists.txt | 6 ++++-- 8 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb7b86ea2..6545f7205 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,9 @@ cmake_minimum_required(VERSION 3.13) -cmake_policy(SET CMP0091 NEW) +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() project(FreeRDP LANGUAGES C ) diff --git a/client/SDL/CMakeLists.txt b/client/SDL/CMakeLists.txt index acc391505..83e27aa73 100644 --- a/client/SDL/CMakeLists.txt +++ b/client/SDL/CMakeLists.txt @@ -17,7 +17,9 @@ cmake_minimum_required(VERSION 3.13) -cmake_policy(SET CMP0091 NEW) +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() if (NOT FREERDP_DEFAULT_PROJECT_VERSION) set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() diff --git a/client/Sample/CMakeLists.txt b/client/Sample/CMakeLists.txt index 71436366a..db4e947ac 100644 --- a/client/Sample/CMakeLists.txt +++ b/client/Sample/CMakeLists.txt @@ -16,7 +16,9 @@ # limitations under the License. cmake_minimum_required(VERSION 3.13) -cmake_policy(SET CMP0091 NEW) +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() if (NOT FREERDP_DEFAULT_PROJECT_VERSION) set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() diff --git a/cmake/CommonConfigOptions.cmake b/cmake/CommonConfigOptions.cmake index b1646aa6f..8d7f485cc 100644 --- a/cmake/CommonConfigOptions.cmake +++ b/cmake/CommonConfigOptions.cmake @@ -8,8 +8,10 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON) # known issue on android, thus disabled until we support newer CMake # https://github.com/android/ndk/issues/1444 if (NOT ANDROID) - cmake_policy(SET CMP0069 NEW) - if(CMAKE_VERSION GREATER_EQUAL "3.24.0") + if(POLICY CMP0069) + cmake_policy(SET CMP0069 NEW) + endif() + if(POLICY CMP0138) cmake_policy(SET CMP0138 NEW) endif() include(CheckIPOSupported) diff --git a/server/proxy/modules/bitmap-filter/CMakeLists.txt b/server/proxy/modules/bitmap-filter/CMakeLists.txt index 2616c2bb3..d2cc03bd0 100644 --- a/server/proxy/modules/bitmap-filter/CMakeLists.txt +++ b/server/proxy/modules/bitmap-filter/CMakeLists.txt @@ -21,7 +21,9 @@ cmake_minimum_required(VERSION 3.13) -cmake_policy(SET CMP0091 NEW) +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() if (NOT FREERDP_DEFAULT_PROJECT_VERSION) set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() diff --git a/server/proxy/modules/demo/CMakeLists.txt b/server/proxy/modules/demo/CMakeLists.txt index 22fb64b28..bdd85a337 100644 --- a/server/proxy/modules/demo/CMakeLists.txt +++ b/server/proxy/modules/demo/CMakeLists.txt @@ -21,7 +21,9 @@ cmake_minimum_required(VERSION 3.13) -cmake_policy(SET CMP0091 NEW) +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() if (NOT FREERDP_DEFAULT_PROJECT_VERSION) set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() diff --git a/server/proxy/modules/dyn-channel-dump/CMakeLists.txt b/server/proxy/modules/dyn-channel-dump/CMakeLists.txt index 500e308c0..dc0fc535b 100644 --- a/server/proxy/modules/dyn-channel-dump/CMakeLists.txt +++ b/server/proxy/modules/dyn-channel-dump/CMakeLists.txt @@ -20,7 +20,9 @@ cmake_minimum_required(VERSION 3.13) -cmake_policy(SET CMP0091 NEW) +if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) +endif() if (NOT FREERDP_DEFAULT_PROJECT_VERSION) set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0") endif() diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index 44853fc52..929fb6428 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -21,8 +21,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/) if (NOT FREERDP_UNIFIED_BUILD) cmake_minimum_required(VERSION 3.13) - cmake_policy(SET CMP0091 NEW) - project(WinPR LANGUAGES C) + if(POLICY CMP0091) + cmake_policy(SET CMP0091 NEW) + endif() + project(WinPR LANGUAGES C) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON)