CMakeLists.txt 656 B

123456789101112131415161718192021
  1. FIND_PACKAGE(PythonInterp 3 REQUIRED)
  2. FILE(GLOB test_cases "test_*.t")
  3. SET(PYTHON_VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/.venv")
  4. SET(PYTHON_VENV_PIP "${PYTHON_VENV_DIR}/bin/pip")
  5. SET(PYTHON_VENV_CRAM "${PYTHON_VENV_DIR}/bin/cram")
  6. ADD_CUSTOM_COMMAND(
  7. OUTPUT ${PYTHON_VENV_CRAM}
  8. COMMAND ${PYTHON_EXECUTABLE} -m venv ${PYTHON_VENV_DIR}
  9. COMMAND ${PYTHON_VENV_PIP} install cram
  10. )
  11. ADD_CUSTOM_TARGET(prepare-cram-venv ALL DEPENDS ${PYTHON_VENV_CRAM})
  12. ADD_TEST(
  13. NAME cram
  14. COMMAND ${PYTHON_VENV_CRAM} ${test_cases}
  15. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  16. )
  17. SET_PROPERTY(TEST cram APPEND PROPERTY ENVIRONMENT "TEST_BIN_DIR=$<TARGET_FILE_DIR:ucert>")