Files
CMake/Tests/RunCMake/FindPython/VirtualEnv.cmake
2025-02-28 17:55:24 +01:00

16 lines
482 B
CMake

find_package(Python3 REQUIRED COMPONENTS Interpreter)
if (NOT Python3_FOUND)
message (FATAL_ERROR "Failed to find Python 3")
endif()
file (REMOVE_RECURSE "${PYTHON3_VIRTUAL_ENV}")
execute_process (COMMAND "${Python3_EXECUTABLE}" -m venv "${PYTHON3_VIRTUAL_ENV}"
RESULT_VARIABLE result
OUTPUT_VARIABLE outputs
ERROR_VARIABLE outputs)
if (result)
message (FATAL_ERROR "Fail to create virtual environment: ${outputs}")
endif()