← Back to team overview

kicad-developers team mailing list archive

Re: CMake doesn't find the right PythonLibs on recent Ubuntus, workaround included

 

Hi Wayne,

It looks like CMake doesn't extract the library version number from
the interpreter--it just finds the highest python version libraries
installed.  Someone wrote up a new FindPythonLibs.cmake that does look
at the running interpreter, and it was rejected in 2011.  This may be
part of why the team has such a hard time with Python and cmake!

The patch to do this would be extremely minimal--check if
PYTHON_VERSION_MAJOR and PYTHON_VERSION_MINOR were set (by
FindPythonInterp) and then replace the version list creation with

set(_FOUND_PYTHON_MAJ_MIN ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})

set(_Python_VERSIONS
   ${Python_ADDITIONAL_VERSIONS}\
   ${_FOUND_PYTHON_MAJ_MIN}\
   ${_PYTHON_FIND_OTHER_VERSIONS}
   )

This would make it search for user specified versions first, then the
detected version, and then the standard Python version list.

Since CMake's Python version detection is currently broken with cmake
on any system where there are installed headers of a newer version
than the default interpreter, which includes Fedora and Ubuntu, do you
think I should write and test this patch, and send it over to the
CMake folks, or do you think that'd be a waste given the fact that
since at least 2011, they've been wanting to first rewrite Python
version detection with FindPython.cmake?
(http://www.cmake.org/pipermail/cmake/2011-November/047799.html)

Adam Wolf
Wayne and Layne, LLC


Follow ups

References