From 8c525d7e16f7613ffc2fb5eb15b78b799dcd5982 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 11 Feb 2021 16:45:45 +0100 Subject: UseSWIG: Run using policy settings from includer Backport commit de7f0aa6c0 (UseSWIG: avoid spurious policy warnings, 2021-02-11) to the 3.20 release branch. Projects need to be able to control policies. Issue: #22029 --- Modules/UseSWIG.cmake | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 7d7f737..b1e0576 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -338,20 +338,11 @@ as well as ``SWIG``: initialized with the value of this variable. #]=======================================================================] -cmake_policy(GET CMP0078 target_name_policy) -cmake_policy(GET CMP0086 module_name_policy) - -cmake_policy (VERSION 3.12) -if (target_name_policy) - # respect user choice regarding CMP0078 policy - cmake_policy(SET CMP0078 ${target_name_policy}) -endif() -if (module_name_policy) - # respect user choice regarding CMP0086 policy - cmake_policy(SET CMP0086 ${module_name_policy}) -endif() -unset(target_name_policy) -unset(module_name_policy) +cmake_policy(PUSH) +# numbers and boolean constants +cmake_policy (SET CMP0012 NEW) +# IN_LIST operator +cmake_policy (SET CMP0057 NEW) set(SWIG_CXX_EXTENSION "cxx") set(SWIG_EXTRA_LIBRARIES "") @@ -911,7 +902,7 @@ function(SWIG_ADD_LIBRARY name) if (APPLE) set_target_properties (${target_name} PROPERTIES SUFFIX ".jnilib") endif() - if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL MSYS) + if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL "MSYS") set_target_properties(${target_name} PROPERTIES PREFIX "") endif() elseif (swig_lowercase_language STREQUAL "lua") @@ -1007,3 +998,5 @@ function(SWIG_LINK_LIBRARIES name) endif() endif() endfunction() + +cmake_policy(POP) -- cgit v0.12 From c3d0b25514bef51f6f17da15470c852194a99b68 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 5 Apr 2021 14:02:15 -0400 Subject: UseSWIG: Transform swig depfile to match Ninja generator paths Since commit 89b01b04fa (UseSWIG: use swig tool to generate dependencies, 2021-01-12, v3.20.0-rc1~120^2) we use a tool-provided depfile to extract dependencies under the Ninja generator. Enable `CMP0116` to ensure depfile paths are translated to match what the Ninja generator writes to the build manfiest. Fixes: #22029 --- Modules/UseSWIG.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index b1e0576..6073125 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -343,6 +343,8 @@ cmake_policy(PUSH) cmake_policy (SET CMP0012 NEW) # IN_LIST operator cmake_policy (SET CMP0057 NEW) +# Ninja generator normalizes custom command depfile paths +cmake_policy (SET CMP0116 NEW) set(SWIG_CXX_EXTENSION "cxx") set(SWIG_EXTRA_LIBRARIES "") -- cgit v0.12