From f7ade7bfeaa7e0d7fb3dd9d5a93e29a413cc142a Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Tue, 21 Jun 2016 15:11:26 -0700 Subject: [PATCH] ARROW-223: Do not link against libpython Author: Uwe L. Korn Closes #95 from xhochy/arrow-223 and squashes the following commits: 4fdf1e7 [Uwe L. Korn] ARROW-223: Do not link against libpython Change-Id: I1238a48aaf94ab175b367551f74c335c6455d78a --- python/cmake_modules/FindPythonLibsNew.cmake | 6 +++++- python/cmake_modules/UseCython.cmake | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/python/cmake_modules/FindPythonLibsNew.cmake b/python/cmake_modules/FindPythonLibsNew.cmake index 0f2295aa43bc1..5cb65c9f1a484 100644 --- a/python/cmake_modules/FindPythonLibsNew.cmake +++ b/python/cmake_modules/FindPythonLibsNew.cmake @@ -224,7 +224,11 @@ FUNCTION(PYTHON_ADD_MODULE _NAME ) SET_TARGET_PROPERTIES(${_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") ELSE() - TARGET_LINK_LIBRARIES(${_NAME} ${PYTHON_LIBRARIES}) + # In general, we should not link against libpython as we do not embed + # the Python interpreter. The python binary itself can then define where + # the symbols should loaded from. + SET_TARGET_PROPERTIES(${_NAME} PROPERTIES LINK_FLAGS + "-Wl,-undefined,dynamic_lookup") ENDIF() IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) SET_TARGET_PROPERTIES(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") diff --git a/python/cmake_modules/UseCython.cmake b/python/cmake_modules/UseCython.cmake index 3b1c201edff5f..cee6066d31de0 100644 --- a/python/cmake_modules/UseCython.cmake +++ b/python/cmake_modules/UseCython.cmake @@ -163,7 +163,6 @@ function( cython_add_module _name pyx_target_name generated_files) include_directories( ${PYTHON_INCLUDE_DIRS} ) python_add_module( ${_name} ${_generated_files} ${other_module_sources} ) add_dependencies( ${_name} ${pyx_target_name}) - target_link_libraries( ${_name} ${PYTHON_LIBRARIES} ) endfunction() include( CMakeParseArguments )