From 9db0dfd75861aeb40433ad8a566c2a5900976659 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 28 Nov 2016 12:46:10 -0500 Subject: 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 --- Modules/FindPythonLibs.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Modules/FindPythonLibs.cmake') diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 1ebbf29621..cd623cf8f8 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() -- cgit v1.2.1