VirtualEnvOnly.cmake 473 B

12345678910111213141516
  1. #
  2. # Virtual environment is defined for python3
  3. # Trying to find a python2 using only virtual environment
  4. # It is expecting to fail if a virtual environment is active and to success otherwise.
  5. #
  6. set (Python2_FIND_VIRTUALENV ONLY)
  7. find_package (Python2 QUIET)
  8. if (PYTHON3_VIRTUAL_ENV AND Python2_FOUND)
  9. message (FATAL_ERROR "Python2 unexpectedly found.")
  10. endif()
  11. if (NOT PYTHON3_VIRTUAL_ENV AND NOT Python2_FOUND)
  12. message (FATAL_ERROR "Fail to find Python2.")
  13. endif()