From ce2cb30fdf2e5ae07b81f4e7bb79943e7958e24a Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Wed, 23 Aug 2017 21:52:44 +0200 Subject: [PATCH] Use swig_add_library with cmake 3.8 --- swig/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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}) -- 2.30.2