Use if(POLICY)

I somehow missed that `if(POLICY CMPxxxx)` exists to wrap `cmp_policy()`
calls so only CMake versions that understand that policy attempt to set
it. Which is way smarter than the version-based logic I was using.
This commit is contained in:
FeRD (Frank Dana)
2019-04-06 19:24:32 -04:00
parent 101f25a7f5
commit 2748e9a2a2
2 changed files with 4 additions and 4 deletions

View File

@@ -30,10 +30,10 @@ FIND_PACKAGE(SWIG 2.0 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
### Enable some legacy SWIG behaviors, in newer CMAKEs
if (CMAKE_VERSION VERSION_GREATER 3.13)
if (POLICY CMP0078)
cmake_policy(SET CMP0078 OLD)
endif()
if (CMAKE_VERSION VERSION_GREATER 3.14)
if (POLICY CMP0086)
cmake_policy(SET CMP0086 OLD)
endif()

View File

@@ -30,10 +30,10 @@ FIND_PACKAGE(SWIG 2.0 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
### Enable some legacy SWIG behaviors, in newer CMAKEs
if (CMAKE_VERSION VERSION_GREATER 3.13)
if (POLICY CMP0078)
cmake_policy(SET CMP0078 OLD)
endif()
if (CMAKE_VERSION VERSION_GREATER 3.14)
if (POLICY CMP0086)
cmake_policy(SET CMP0086 OLD)
endif()