Hello,
As CMP0054 changes the way IF() works this patch fixes it in UseSWIG.cmake. PERL seems to be reserved word so work around this every language get x fore them. so you compare xPERL not bare word PERL. This should fix CMP0054 requirements.

Sincerely,
Tuukka
>From a5fb628109433b2c837ffdaaaa2fffef511108d4 Mon Sep 17 00:00:00 2001
From: Tuukka Pasanen <[email protected]>
Date: Sat, 7 Mar 2015 19:03:45 +0200
Subject: [PATCH] Fix CMP0054 error on UseSWIG. Fix is little bit not satifying
 because of my lack of undestanding how this really should be corrected.
 CMP0054 changes how variables behave inside IF() and PERL is word that is in
 use. We make up one that have x front of name of requested language (for
 example PERL to xPERL)

It's done this way:
  set(SWIG_MODULE_TEMPNAME_LANGUAGE "x${SWIG_MODULE_${name}_LANGUAGE}")

and then we compare this later on so CMake can add needed compiler parameters
for chosen language.
---
 Modules/UseSWIG.cmake | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index bab1b21..c4d23cb 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -72,20 +72,24 @@ macro(SWIG_MODULE_INITIALIZE name language)
   set(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}")
   set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}")
 
+  # To workaround CMP0054 we create temporal name for STREQUAL
+  # Because with PERL this one doesn't work
+  set(SWIG_MODULE_TEMPNAME_LANGUAGE "x${SWIG_MODULE_${name}_LANGUAGE}")
+
   set(SWIG_MODULE_${name}_REAL_NAME "${name}")
   if (";${CMAKE_SWIG_FLAGS};" MATCHES ";-noproxy;")
     set (SWIG_MODULE_${name}_NOPROXY TRUE)
   endif ()
-  if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN")
+  if(${SWIG_MODULE_TEMPNAME_LANGUAGE} STREQUAL "xUNKNOWN")
     message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found")
-  elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
+  elseif(${SWIG_MODULE_TEMPNAME_LANGUAGE} STREQUAL "xPYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)
     # swig will produce a module.py containing an 'import _modulename' statement,
     # which implies having a corresponding _modulename.so (*NIX), _modulename.pyd (Win32),
     # unless the -noproxy flag is used
     set(SWIG_MODULE_${name}_REAL_NAME "_${name}")
-  elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL")
+  elseif(${SWIG_MODULE_TEMPNAME_LANGUAGE} STREQUAL "xPERL")
     set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow")
-  elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "CSHARP")
+  elseif(${SWIG_MODULE_TEMPNAME_LANGUAGE} STREQUAL "xCSHARP")
     # This makes sure that the name used in the generated DllImport
     # matches the library name created by CMake
     set(SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport;${name}")
-- 
2.1.4

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to