Repository: arrow Updated Branches: refs/heads/master 39e487c30 -> b640cc0e7
ARROW-1610: C++/Python: Only call python-prefix if the default PYTHON_LIBRARY is not present Author: Korn, Uwe <[email protected]> Closes #1130 from xhochy/ARROW-1610 and squashes the following commits: 8c7c190e [Korn, Uwe] ARROW-1610: C++/Python: Only call python-prefix if the default PYTHON_LIBRARY is not present Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/b640cc0e Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/b640cc0e Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/b640cc0e Branch: refs/heads/master Commit: b640cc0e78b41cb26e8e5d11a76d20d759654d44 Parents: 39e487c Author: Korn, Uwe <[email protected]> Authored: Mon Sep 25 23:01:33 2017 -0400 Committer: Wes McKinney <[email protected]> Committed: Mon Sep 25 23:01:33 2017 -0400 ---------------------------------------------------------------------- cpp/cmake_modules/FindPythonLibsNew.cmake | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/b640cc0e/cpp/cmake_modules/FindPythonLibsNew.cmake ---------------------------------------------------------------------- diff --git a/cpp/cmake_modules/FindPythonLibsNew.cmake b/cpp/cmake_modules/FindPythonLibsNew.cmake index 09124aa..4004256 100644 --- a/cpp/cmake_modules/FindPythonLibsNew.cmake +++ b/cpp/cmake_modules/FindPythonLibsNew.cmake @@ -149,19 +149,21 @@ if(CMAKE_HOST_WIN32) set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/libpython${PYTHON_LIBRARY_SUFFIX}.a") endif() elseif(APPLE) - # In some cases libpythonX.X.dylib is not part of the PYTHON_PREFIX and we - # need to call `python-config --prefix` to determine the correct location. - find_program(PYTHON_CONFIG python-config - NO_CMAKE_SYSTEM_PATH) - if (PYTHON_CONFIG) - execute_process( - COMMAND "${PYTHON_CONFIG}" "--prefix" - OUTPUT_VARIABLE PYTHON_CONFIG_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(PYTHON_LIBRARY "${PYTHON_CONFIG_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib") - else() - set(PYTHON_LIBRARY "${PYTHON_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib") + set(PYTHON_LIBRARY "${PYTHON_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib") + + if (NOT EXISTS ${PYTHON_LIBRARY}) + # In some cases libpythonX.X.dylib is not part of the PYTHON_PREFIX and we + # need to call `python-config --prefix` to determine the correct location. + find_program(PYTHON_CONFIG python-config + NO_CMAKE_SYSTEM_PATH) + if (PYTHON_CONFIG) + execute_process( + COMMAND "${PYTHON_CONFIG}" "--prefix" + OUTPUT_VARIABLE PYTHON_CONFIG_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(PYTHON_LIBRARY "${PYTHON_CONFIG_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib") + endif() endif() else() if(${PYTHON_SIZEOF_VOID_P} MATCHES 8)
