From 2748e9a2a285f11639e71c1502e88bbead733cf7 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Sat, 6 Apr 2019 19:24:32 -0400 Subject: [PATCH] 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. --- src/bindings/python/CMakeLists.txt | 4 ++-- src/bindings/ruby/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bindings/python/CMakeLists.txt b/src/bindings/python/CMakeLists.txt index 93ae9360..3418d2de 100644 --- a/src/bindings/python/CMakeLists.txt +++ b/src/bindings/python/CMakeLists.txt @@ -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() diff --git a/src/bindings/ruby/CMakeLists.txt b/src/bindings/ruby/CMakeLists.txt index 82c9d5d5..7e3bce99 100644 --- a/src/bindings/ruby/CMakeLists.txt +++ b/src/bindings/ruby/CMakeLists.txt @@ -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()