FindPython: cmake-3.16.0-rc2 produce syntax error with multiple python versions
When running following case in an linux environment which has multiple python versions(2.7, 3.5, 3.6, 3.7, 3.8, pypy3, pypy and virtualenv) and activated virtualenv py36.
cmake_minimum_required(VERSION 3.16)
project(findpythone LANGUAGES C)
set(Python_FIND_STRATEGY LOCATION)
find_package(Python COMPONENTS Interpreter Development)
it fails to run with following error.
CMake Error at /opt/cmake-3.16.0-rc2-Linux-x86_64/share/cmake-3.16/Modules/FindPython/Support.cmake:2057 (if):
if given arguments:
"_Python_INC_VERSION" "VERSION_EQUAL"
Unknown arguments specified
Call Stack (most recent call first):
/opt/cmake-3.16.0-rc2-Linux-x86_64/share/cmake-3.16/Modules/FindPython.cmake:326 (include)
CMakeLists.txt:6 (find_package)
and cache values are
Python_EXECUTABLE:FILEPATH=/home/miurahr/.virtualenvs/py36/bin/python
Python_INCLUDE_DIR:PATH=/usr/include/python2.7
Python_LIBRARY_DEBUG:FILEPATH=
Python_LIBRARY_RELEASE:FILEPATH=_Python_LIBRARY_RELEASE-NOTFOUND
_Python_CONFIG:FILEPATH=/usr/bin/x86_64-linux-gnu-python2.7-config
_Python_LIBRARY_RELEASE:FILEPATH=_Python_LIBRARY_RELEASE-NOTFOUND
I know current FindPython has a limitation on finding one from environment which has multiple versions, but this type of error should not be happened.
Here is a version to use run a test.
$ cmake --version
cmake version 3.16.0-rc2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
When running with cmake 3.15.4, it run without syntax error.
-- Could NOT find Python (missing: Interpreter) (found version "2.7.15+")
OK
-- Configuring done
-- Generating done
-- Build files have been written to: /home/miurahr/projects/cmake-findpython-case/build
-- Cache values
and cache variable becomes
Python_EXECUTABLE:FILEPATH=/home/miurahr/.virtualenvs/py36/bin/python
Python_INCLUDE_DIR:PATH=/usr/include/python2.7
Python_LIBRARY_DEBUG:FILEPATH=Python_LIBRARY_DEBUG-NOTFOUND
Python_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython2.7.so
_Python_LIBRARY_RELEASE:FILEPATH=_Python_LIBRARY_RELEASE-NOTFOUND