FindPython* logic does not handle hints properly with conda
Hi, I would like to use the new FindPython* logic with a couple of conda environments to build multiple versions of a python extension.
# setup build using py36_64
set(Python3_ROOT_DIR "${CONDA_ROOT}/envs/py36_64/")
find_package(Python3 COMPONENTS Interpreter Development)
# do stuff to build py36_64 extension module ...
# setup build using py37_64
set(Python3_ROOT_DIR "${CONDA_ROOT}/envs/py37_64/")
find_package(Python3 COMPONENTS Interpreter Development)
# do stuff to build py37_64 extension module ...
# setup build using py27_64
set(Python2_ROOT_DIR "${CONDA_ROOT}/envs/py27_64/")
find_package(Python2 COMPONENTS Interpreter Development)
# do stuff to build py27_64 extension module ...
I attached a small test CMakeLists.txt, that prints the cmake variables that are picked on every call above and the outputs when I generate the project on linux, mac, and windows.
The behavior is very inconsistent, and makes it hard to use these packages.
-
lin, cmake 3.14.2
- py36 Interpreter: OK Development: OK
- py37 Interpreter: OK Development: FAIL
- py27 Interpreter: OK Development: OK
-
mac, cmake 3.15.4
- py36 Interpreter: FAIL Development: FAIL
- py37 Interpreter: OK Development: FAIL
- py27 Interpreter: OK Development: OK
-
win, cmake 3.15.2
- py36 Interpreter: FAIL Development: OK
- py37 Interpreter: FAIL Development: FAIL
- py27 Interpreter: FAIL Development: FAIL
For example even though the HINT explicitly indicates the directory to search for the specific version of python,
e.g. ${CONDA_ROOT}/envs/py36_64/
, it will actually use the base environment of conda. This does not make sense.
Also adding the explicit version like
set(Python3_ROOT_DIR "${CONDA_ROOT}/envs/py36_64/")
find_package(Python3 3.6 COMPONENTS Interpreter Development)
does not solve the problem.
This looks a bug or am I missing something ?
Thanks, Jiri