From 8a2f62cc18ece0ebfed0ff6abf53d419d43d2fa1 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Mon, 1 Apr 2019 11:19:54 +0200 Subject: FindPython*: Add capability to control virtual env handling. Fixes: #19097 --- Modules/FindPython.cmake | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'Modules/FindPython.cmake') diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 1c134e278b..c5074e8b3d 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -145,18 +145,30 @@ Hints * ``NEVER``: Never try to use registry. ``CMAKE_FIND_FRAMEWORK`` - On OS X the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of + On macOS the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of preference between Apple-style and unix-style package components. .. note:: Value ``ONLY`` is not supported so ``FIRST`` will be used instead. -.. note:: +``Python_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 + ``Python_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables. + The ``Python_FIND_VIRTUALENV`` variable can be set to empty or one of the + following: - If a Python virtual environment is configured, set variable - ``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with - value ``LAST`` or ``NEVER`` to select it preferably. + * ``FIRST``: The virtual environment is used before any other standard + paths to look-up for the interpreter. This is the default. + * ``ONLY``: Only the virtual environment is used to look-up for the + interpreter. + * ``STANDARD``: The virtual environment is not used to look-up for the + interpreter. In this case, variable ``Python_FIND_REGISTRY`` (Windows) + or ``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with value ``LAST`` or + ``NEVER`` to select preferably the interpreter from the virtual + environment. Commands ^^^^^^^^ -- cgit v1.2.1