From 748c7896d6a9142b4d473d288cd59c3921ebecf8 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 6 Mar 2011 08:45:17 +0000
Subject: [PATCH]

---
 CMakeLists.txt | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 411122e610..6cc23de970 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -909,19 +909,23 @@ elseif(MSVC)
 endif(WIN32 AND NOT MSVC)
 
 if(ENABLE_SWIG)
-  find_package(SWIG REQUIRED)
-  message(STATUS "Found SWIG version " ${SWIG_VERSION})
-  string(SUBSTRING ${SWIG_VERSION} 0 1 SWIG_MAJOR_VERSION)
-  if(SWIG_MAJOR_VERSION EQUAL 1)
-    message("WARNING: Python bindings require SWIG >= 2: disabling Python")
-  else(SWIG_MAJOR_VERSION EQUAL 1)
-    include(${SWIG_USE_FILE})
-    find_package(PythonLibs)
-    include_directories(${PYTHON_INCLUDE_DIR})
-    set_source_files_properties(Common/gmshpy.i PROPERTIES CPLUSPLUS ON)
-    swig_add_module(gmshpy python Common/gmshpy.i)
-    swig_link_libraries(gmshpy ${PYTHON_LIBRARIES} ${EXTERNAL_LIBRARIES} ${LINK_LIBRARIES} shared)
-  endif(SWIG_MAJOR_VERSION EQUAL 1)
+  find_package(SWIG)
+  if(SWIG_FOUND)
+    message(STATUS "Found SWIG version " ${SWIG_VERSION})
+    string(SUBSTRING ${SWIG_VERSION} 0 1 SWIG_MAJOR_VERSION)
+    if(SWIG_MAJOR_VERSION EQUAL 1)
+      message("WARNING: Python bindings require SWIG >= 2: disabling Python")
+    else(SWIG_MAJOR_VERSION EQUAL 1)
+      include(${SWIG_USE_FILE})
+      find_package(PythonLibs)
+      include_directories(${PYTHON_INCLUDE_DIR})
+      set_source_files_properties(Common/gmshpy.i PROPERTIES CPLUSPLUS ON)
+      swig_add_module(gmshpy python Common/gmshpy.i)
+      swig_link_libraries(gmshpy ${PYTHON_LIBRARIES} ${LINK_LIBRARIES} shared)
+    endif(SWIG_MAJOR_VERSION EQUAL 1)
+  else(SWIG_FOUND)
+    message("WARNING: Could not find SWIG")    
+  endif(SWIG_FOUND)
 endif(ENABLE_SWIG)
 
 find_program(BISON bison)
-- 
GitLab