summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-02-11 16:45:45 +0100
committerMarc Chevrier <marc.chevrier@gmail.com>2021-02-11 17:17:10 +0100
commitde7f0aa6c0d3429342ce1b5aa94f9d2a43f85e12 (patch)
treeff15ad0d9ff0503b01a099eb8cab06d4eab0c728
parentd4d67810c1e39d337d274e6a4a15275f5a645db2 (diff)
downloadcmake-de7f0aa6c0d3429342ce1b5aa94f9d2a43f85e12.tar.gz
UseSWIG: avoid spurious policy warnings
-rw-r--r--Modules/UseSWIG.cmake23
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt14
2 files changed, 8 insertions, 29 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 7d7f7377c5..b1e0576978 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)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt
index e8eadedd51..2afdc4f492 100644
--- a/Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt
+++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stderr.txt
@@ -7,18 +7,4 @@
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack \(most recent call first\):
- CMakeLists.txt:[0-9]+ \(include\)
-+
-CMake Deprecation Warning at [^
-]*/Modules/UseSWIG.cmake:[0-9]+ \(cmake_policy\):
- The OLD behavior for policy CMP0078 will be removed from a future version
- of CMake.
-
- The cmake-policies\(7\) manual explains that the OLD behaviors of all
- policies are deprecated and that a policy should be set to OLD only under
- specific short-term circumstances. Projects should be ported to the NEW
- behavior and not rely on setting a policy to OLD.
-Call Stack \(most recent call first\):
- CMP0078-common.cmake:[0-9]+ \(include\)
- CMP0078-OLD.cmake:[0-9]+ \(include\)
CMakeLists.txt:[0-9]+ \(include\)$