diff --git a/CMakeLists.txt b/CMakeLists.txt index 411122e610c8da1c712bb99a39ab14ff05ce7c5f..6cc23de970b3c61c601f12226286136e4034b132 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)