summaryrefslogtreecommitdiffstats
path: root/Modules/FindPythonLibs.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-28 17:46:10 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-28 17:49:02 (GMT)
commit9db0dfd75861aeb40433ad8a566c2a5900976659 (patch)
tree2a189f76c67b9f632a2dc56e1fc8b0a609b3494f /Modules/FindPythonLibs.cmake
parenta6fe714eaa6e25c2a661c3ec57f7eb8b8dbadede (diff)
downloadCMake-9db0dfd75861aeb40433ad8a566c2a5900976659.zip
CMake-9db0dfd75861aeb40433ad8a566c2a5900976659.tar.gz
CMake-9db0dfd75861aeb40433ad8a566c2a5900976659.tar.bz2
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
Diffstat (limited to 'Modules/FindPythonLibs.cmake')
-rw-r--r--Modules/FindPythonLibs.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 1ebbf29..cd623cf 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -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()