VirtualEnvOnly.cmake 510 B

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