mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-03 04:03:23 +03: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:
1 parent
a6fe714eaa
commit
9db0dfd758
1 file changed
+4
-4
@@ -42,16 +42,16 @@
|
|||||||
|
|
||||||
# Use the executable's path as a hint
|
# Use the executable's path as a hint
|
||||||
set(_Python_LIBRARY_PATH_HINT)
|
set(_Python_LIBRARY_PATH_HINT)
|
||||||
if(PYTHON_EXECUTABLE)
|
if(IS_ABSOLUTE "${PYTHON_EXECUTABLE}")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
|
get_filename_component(_Python_PREFIX "${PYTHON_EXECUTABLE}" PATH)
|
||||||
if(_Python_PREFIX)
|
if(_Python_PREFIX)
|
||||||
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/libs)
|
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/libs)
|
||||||
endif()
|
endif()
|
||||||
unset(_Python_PREFIX)
|
unset(_Python_PREFIX)
|
||||||
else()
|
else()
|
||||||
get_filename_component(_Python_PREFIX ${PYTHON_EXECUTABLE} PATH)
|
get_filename_component(_Python_PREFIX "${PYTHON_EXECUTABLE}" PATH)
|
||||||
get_filename_component(_Python_PREFIX ${_Python_PREFIX} PATH)
|
get_filename_component(_Python_PREFIX "${_Python_PREFIX}" PATH)
|
||||||
if(_Python_PREFIX)
|
if(_Python_PREFIX)
|
||||||
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/lib)
|
set(_Python_LIBRARY_PATH_HINT ${_Python_PREFIX}/lib)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in new issue
Block a user