diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2018-11-16 15:24:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-11-19 20:36:26 (GMT) |
commit | c24f29c6647f70e6597dd35a1fe276279e019ad4 (patch) | |
tree | 5f0c2ba9eb52541bbfa98bc93b36e616eac64a0a /Modules/FindPython | |
parent | 8d70ed5a10362209d265a15d993f319235aea7e5 (diff) | |
download | CMake-c24f29c6647f70e6597dd35a1fe276279e019ad4.zip CMake-c24f29c6647f70e6597dd35a1fe276279e019ad4.tar.gz CMake-c24f29c6647f70e6597dd35a1fe276279e019ad4.tar.bz2 |
FindPython: Ensure config tool matches library architecture
Diffstat (limited to 'Modules/FindPython')
-rw-r--r-- | Modules/FindPython/Support.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 5b1ed4b..e0ebb90 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -711,6 +711,23 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS if (NOT _${_PYTHON_PREFIX}_CONFIG) continue() endif() + if (DEFINED CMAKE_LIBRARY_ARCHITECTURE) + # check that config tool match library architecture + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --configdir + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_CONFIGDIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (_${_PYTHON_PREFIX}_RESULT) + unset (_${_PYTHON_PREFIX}_CONFIG CACHE) + continue() + endif() + string(FIND "${_${_PYTHON_PREFIX}_CONFIGDIR}" "${CMAKE_LIBRARY_ARCHITECTURE}" _${_PYTHON_PREFIX}_RESULT) + if (_${_PYTHON_PREFIX}_RESULT EQUAL -1) + unset (_${_PYTHON_PREFIX}_CONFIG CACHE) + continue() + endif() + endif() # retrieve root install directory execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --prefix |