From: Julien Schueller Date: Wed, 23 Aug 2017 19:52:44 +0000 (+0200) Subject: Use swig_add_library with cmake 3.8 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ce2cb30fdf2e5ae07b81f4e7bb79943e7958e24a;p=nlopt.git Use swig_add_library with cmake 3.8 --- diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index 71c6f78..5531de8 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -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})