diff options
Diffstat (limited to 'Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake')
-rw-r--r-- | Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake b/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake new file mode 100644 index 0000000..29a4924 --- /dev/null +++ b/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake @@ -0,0 +1,16 @@ + +# +# Virtual environment is defined for python3 +# Trying to find a python2 using only virtual environment +# It is expecting to fail if a virtual environment is active and to success otherwise. +# +set (Python2_FIND_VIRTUALENV ONLY) +find_package (Python2 QUIET) + +if (PYTHON3_VIRTUAL_ENV AND Python2_FOUND) + message (FATAL_ERROR "Python2 unexpectedly found.") +endif() + +if (NOT PYTHON3_VIRTUAL_ENV AND NOT Python2_FOUND) + message (FATAL_ERROR "Fail to find Python2.") +endif() |