diff options
author | Brad King <brad.king@kitware.com> | 2016-12-16 13:26:16 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-12-16 13:26:16 (GMT) |
commit | 58dc3745ec925923713f16c0e77bc9277b29eb7d (patch) | |
tree | 9a329a89dc9c498299e6e7f357e2a93667a16a30 /Modules | |
parent | ed8a9cb7de9323709b125eb4af97cc6a8c444a66 (diff) | |
parent | a12d8a03af8430d0a570c97deb200e16830568eb (diff) | |
download | CMake-58dc3745ec925923713f16c0e77bc9277b29eb7d.zip CMake-58dc3745ec925923713f16c0e77bc9277b29eb7d.tar.gz CMake-58dc3745ec925923713f16c0e77bc9277b29eb7d.tar.bz2 |
Merge topic 'FindPythonLibs-tolerate-components'
a12d8a03 FindPythonLibs: Tolerate call with PYTHON_LIBRARY already a list
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindPythonLibs.cmake | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index cd623cf..63ec9a8 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -168,12 +168,19 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) # Use the library's install prefix as a hint set(_Python_INCLUDE_PATH_HINT) - get_filename_component(_Python_PREFIX ${PYTHON_LIBRARY} PATH) - get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH) - if(_Python_PREFIX) - set(_Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include) - endif() - unset(_Python_PREFIX) + # PYTHON_LIBRARY may contain a list because of SelectLibraryConfigurations + # which may have been run previously. If it is the case, the list can be: + # optimized;<FILEPATH_TO_RELEASE_LIBRARY>;debug;<FILEPATH_TO_DEBUG_LIBRARY> + foreach(lib ${PYTHON_LIBRARY} ${PYTHON_DEBUG_LIBRARY}) + if(IS_ABSOLUTE "${lib}") + get_filename_component(_Python_PREFIX "${lib}" PATH) + get_filename_component(_Python_PREFIX "${_Python_PREFIX}" PATH) + if(_Python_PREFIX) + list(APPEND _Python_INCLUDE_PATH_HINT ${_Python_PREFIX}/include) + endif() + unset(_Python_PREFIX) + endif() + endforeach() # Add framework directories to the search paths set(PYTHON_FRAMEWORK_INCLUDES) |