chiark / gitweb /
link python libs
authorxantares <xantares09@hotmail.com>
Sat, 21 Feb 2015 07:13:48 +0000 (08:13 +0100)
committerxantares <xantares09@hotmail.com>
Sat, 21 Feb 2015 07:13:48 +0000 (08:13 +0100)
swig/CMakeLists.txt

index 056446370e37c7d018948010796e28de863dd023..d2fa84d51b1100b493e117b178fdf84260985043 100644 (file)
@@ -15,6 +15,8 @@ if (BUILD_PYTHON AND PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR
   if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-python.cpp)
     set (SWIG_MODULE_nlopt_REAL_NAME _nlopt)
     add_library (${SWIG_MODULE_nlopt_REAL_NAME} MODULE nlopt-python.cpp)
+    target_link_libraries(${SWIG_MODULE_nlopt_REAL_NAME} nlopt)
+    target_link_libraries(${SWIG_MODULE_nlopt_REAL_NAME} ${PYTHON_LIBRARIES})
     set_target_properties (${SWIG_MODULE_nlopt_REAL_NAME} PROPERTIES PREFIX "")
     if (NOT CMAKE_SOURCE_DIR MATCHES CMAKE_BINARY_DIR)
       execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/nlopt.py ${CMAKE_CURRENT_BINARY_DIR}/nlopt.py)
@@ -26,8 +28,8 @@ if (BUILD_PYTHON AND PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR
 
     swig_add_module (nlopt python nlopt.i)
     swig_link_libraries (nlopt nlopt)
+    swig_link_libraries (nlopt ${PYTHON_LIBRARIES})
   endif ()
-
   execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
                     OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
                     OUTPUT_STRIP_TRAILING_WHITESPACE )