libftdi Archives

Subject: [PATCH] Simplify CMake policy guard

From: "FeRD (Frank Dana)" <ferdnyc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 26 Sep 2019 21:39:22 -0400
This patch against the cmake-swig-updates branch uses
if (POLICY ... ) to gate the policy setting against the
existence of the policy itself, instead of any specific
CMake version. A handy trick I picked up somewhere.

Signed-off-by: FeRD (Frank Dana) <ferdnyc@xxxxxxxxx>
---
 python/CMakeLists.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 494f6ff..4f758d5 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -1,7 +1,7 @@
-# swig_add_library behavior changed in cmake 3.13 and SWIG_MODULE_<target>_REAL_NAME
-# is no longer set by default so set policy to the old behavior.
-if(NOT CMAKE_VERSION VERSION_LESS 3.13.0)
-  cmake_policy(SET CMP0078 OLD)
+# swig_add_library behavior changed in cmake 3.13 to no longer set
+# SWIG_MODULE_<target>_REAL_NAME, so restore the old behavior.
+if ( POLICY CMP0078 )
+  cmake_policy( SET CMP0078 OLD )
 endif ()
  # workaround for cmake bug #0013449
--
2.21.0


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
Current Thread