MantisBT - CMake
View Issue Details
0014920CMakeCMakepublic2014-05-16 11:192016-06-10 14:31
George Sakhnovsky 
Kitware Robot 
lowminoralways
closedmoved 
Windows 7Windows 7Windows 7
CMake 2.8.12.2 
 
0014920: find_package PythonInterp & PythonLibs fails if packages have been found previously
The following are set in the main CMakeLists.txt:

set (PYTHON_EXECUTABLE "${ADS_DIR}/Python_2_7_3/Win32/python.exe")
set (PYTHON_INCLUDE_DIR "${ADS_DIR}/Python_2_7_3/include")
set (PYTHON_LIBRARY "${ADS_DIR}/Python_2_7_3/Win32/libs/python27.lib")

The first time find_package(PythonInterp) or find_package(PythonLibs) are called, whether from the main CMakeLists.txt or that added via add_subdirectory, the call is successful:

Found PythonInterp: D:/tfs/ADSDIR/Python_2_7_3/Win32/python.exe (found version "2.7.3")
Found PythonLibs: D:/tfs/ADSDIR/Python_2_7_3/Win32/libs/python27.lib (found version "2.7.3")

However, from this point on, any time find_package(PythonInterp) or find_package(PythonLibs) are called, they fail and seemingly remove all knowledge of the python instance being found, including un-setting PYTHONINTERP_FOUND and PYTHONLIBS_FOUND:

Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (found version "2.7.3")
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)

This is in contradiction to how find_package works with other targets such as QT and VTK.

As a temporary band-aid I added conditionals:

#if (NOT PYTHONLIBS_FOUND)
    FIND_PACKAGE(PythonLibs)
#endif (NOT PYTHONLIBS_FOUND)

Is this behavior of add_package by design or a bug?
No tags attached.
Issue History
2014-05-16 11:19George SakhnovskyNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042548
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042548)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.