Hi,
I have a suggestion for the PythonInterp. On a system I am compiling my
code on, I need to find the python binary which is newer than 2.5.
However, the default /usr/bin/python is 2.4.
If I then set the variable (which is not documented in the header by the
way) PythonInterp_FIND_VERSION to 2.5, it will first search for the
following list of binary names:
python2.5 python2 python.
It then finds python2 (and would find python) which points to python2.4.
I do not have python2.5 on this system, only 2.6.
Now I know my way around this myself, but I think the implementation of
this script would be nicer with the attached patch. The list of binary
names in the first search then becomes:
python2.5 python2.7 python2.6 python2.5 python2 python
Any comments? Do people agree? Am I missing some important reason for
the current behaviour?
Cheers,
Yngve
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 7fb65b8..60a0f53 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -39,15 +39,17 @@ if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
- list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
+ list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN})
unset(_PYTHON_FIND_OTHER_VERSIONS)
if(NOT PythonInterp_FIND_VERSION_EXACT)
foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
+ list(APPEND _Python_NAMES python${_PYTHON_V})
endif()
endforeach()
endif()
+ list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ})
unset(_PYTHON_FIND_MAJ_MIN)
unset(_PYTHON_FIND_MAJ)
else()
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake