chiark / gitweb /
Use swig_add_library with cmake 3.8
authorJulien Schueller <schueller@phimeca.com>
Wed, 23 Aug 2017 19:52:44 +0000 (21:52 +0200)
committerJulien Schueller <schueller@phimeca.com>
Wed, 23 Aug 2017 19:54:07 +0000 (21:54 +0200)
swig/CMakeLists.txt

index 71c6f78e350440875b6fcc98255378042e7a2a33..5531de8e49ba29da97eed9d1eeb1b9230ccd81fa 100644 (file)
@@ -29,7 +29,12 @@ if (NUMPY_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR (EXISTS ${CMAKE_CURRENT_
     set (SWIG_MODULE_nlopt_EXTRA_DEPS nlopt-python.i numpy.i)
 
     include_directories (${NLOPT_PRIVATE_INCLUDE_DIRS})
-    swig_add_module (nlopt python nlopt.i)
+    if (CMAKE_VERSION VERSION_LESS 3.8)
+      swig_add_module (nlopt python nlopt.i)
+    else ()
+      swig_add_library (nlopt LANGUAGE python SOURCES nlopt.i)
+    endif ()
+
     swig_link_libraries (nlopt ${nlopt_lib})
     swig_link_libraries (nlopt ${PYTHON_LIBRARIES})
     target_include_directories (${SWIG_MODULE_nlopt_REAL_NAME} PRIVATE ${NLOPT_PRIVATE_INCLUDE_DIRS})