mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-13 09:58:29 -05:00
FindPythonLibs: Tolerate a non-absolute PYTHON_EXECUTABLE
The `PYTHON_EXECUTABLE` variable normally contains an absolute path, but tolerate cases when it does not without calling `get_filename_component` with an incorrect number of arguments. Closes: #16452
This commit is contained in:
@@ -42,16 +42,16 @@
|
||||
|
||||
# Use the executable's path as a hint
|
||||
set(_Python_LIBRARY_PATH_HINT)
|
||||
if(PYTHON_EXECUTABLE)
|
||||
if(IS_ABSOLUTE "${PYTHON_EXECUTABLE}")
|
||||
if(WIN32)
|
||||
get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
|
||||
get_filename_component(_Python_PREFIX "${PYTHON_EXECUTABLE}" PATH)
|
||||
if(_Python_PREFIX)
|
||||
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/libs)
|
||||
endif()
|
||||
unset(_Python_PREFIX)
|
||||
else()
|
||||
get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
|
||||
get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
|
||||
get_filename_component(_Python_PREFIX "${PYTHON_EXECUTABLE}" PATH)
|
||||
get_filename_component(_Python_PREFIX "${_Python_PREFIX}" PATH)
|
||||
if(_Python_PREFIX)
|
||||
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/lib)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user