FindPythonLibs: unset temporary _PREFIX variable

To avoid pollution, unset variables that are only meant for local use.
This commit is contained in:
David Gobbi 2015-09-17 10:00:03 -06:00 committed by Brad King
parent f8bc4e1118
commit 19934b67e9
1 changed files with 14 additions and 11 deletions

View File

@ -53,16 +53,18 @@
set(_Python_LIBRARY_PATH_HINT)
if(PYTHON_EXECUTABLE)
if(WIN32)
get_filename_component(_PREFIX ${PYTHON_EXECUTABLE} PATH)
if(_PREFIX)
set(_Python_LIBRARY_PATH_HINT ${_PREFIX}/libs)
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(_PREFIX ${PYTHON_EXECUTABLE} PATH)
get_filename_component(_PREFIX ${_PREFIX} PATH)
if(_PREFIX)
set(_Python_LIBRARY_PATH_HINT ${_PREFIX}/lib)
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()
unset(_Python_PREFIX)
endif()
endif()
@ -175,11 +177,12 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
# Use the library's install prefix as a hint
set(_Python_INCLUDE_PATH_HINT)
get_filename_component(_PREFIX ${PYTHON_LIBRARY} PATH)
get_filename_component(_PREFIX ${_PREFIX} PATH)
if(_PREFIX)
set(_Python_INCLUDE_PATH_HINT ${_PREFIX}/include)
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)
# Add framework directories to the search paths
set(PYTHON_FRAMEWORK_INCLUDES)