Skip to content

Document optional possibility to hardcode a Python directory #1246

@simonsan

Description

@simonsan

With the update to Python3.cmake -DPYTHON_DIR is used as a HINT to search for a suitable Python3 version.

Sometimes just hinting towards a location is not enough and you would like to hardcode that and let the process fail miserably if nothing is found.

To keep the hinting behaviour of -DPYTHON_DIR=<path> we should add -DFORCE_PYTHON_DIR=TRUE that will switch from hinting => enforcing the search in PYTHON_DIR and nowhere else.

The whole processing in packaged CMake runs in an extra file from Python3.cmake kept in FindPython/Support.cmake that we would need to adopt to buildsystem/modules/FindPython/Support.cmake to let it be used by CMake and overwrite default behaviour.

Be aware, that we are limited to the 3.12.x version and functionality of CMake as this is our minimum version requirement, there are newer version of the files and It would make sense to test how far we can update that with the usage of our CMake 3.12.x minimum requirement. In the newer version there is a find virtual environment handling included that could be interesting for example.

Python3_FIND_VIRTUALENV
This variable defines the handling of virtual environments. It is meaningfull
only when a virtual environment is active (i.e. the activate script has
been evaluated). In this case, it takes precedence over
Python3_FIND_REGISTRY and CMAKE_FIND_FRAMEWORK variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: buildsystemRelated to our cmake/python buildsystemdocumentationInvolves the project documentationimprovementEnhancement of an existing component

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions