[cmake-developers] [CMake 0014920]: find_package PythonInterp & PythonLibs fails if packages have been found previously
Mantis Bug Tracker
mantis at public.kitware.com
Fri May 16 11:19:21 EDT 2014
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=14920
======================================================================
Reported By: George Sakhnovsky
Assigned To:
======================================================================
Project: CMake
Issue ID: 14920
Category: CMake
Reproducibility: always
Severity: minor
Priority: low
Status: new
======================================================================
Date Submitted: 2014-05-16 11:19 EDT
Last Modified: 2014-05-16 11:19 EDT
======================================================================
Summary: find_package PythonInterp & PythonLibs fails if
packages have been found previously
Description:
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?
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2014-05-16 11:19 George SakhnovskyNew Issue
======================================================================
More information about the cmake-developers
mailing list