CMAKE_LIBRARY_PATH set when searching for Python, causes problems later on

Issue #189 resolved
Chris Richardson created an issue

I've run across a problem with package finding on a HPC system. I acknowledge this may not be a common problem. There is a check for Python around line 300 of CMakeLists.txt:

if ("${_PYTHON_LIB_RESULT}" STREQUAL "0")                                                                                                   
  set(CMAKE_LIBRARY_PATH ${_PYTHON_LIB_PATH})                                                                                               
endif()                                              
# Find Pythons libs                                                                                                                         
find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT QUIET REQUIRED)

Later on, this CMAKE_LIBRARY_PATH influences the search for other packages in a negative way (i.e. it looks there first, which may not be the right place). Would it be possible to clear it after finding PythonLibs? e.g.

set(CMAKE_LIBRARY_PATH "")

Or, maybe there is another workaround?

Comments (3)

  1. Prof Garth Wells

    It should be ok to remove it - the reason for the Python checks is to get CMake to find compatible Python interpreters and libraries (so it's basically a work-around for a CMake bug).

    You might want to store CMAKE_LIBRARY_PATH before the Python tests and then reset it rather than clearing it.

  2. Log in to comment