CMakeLists.txt 851 B

1234567891011121314151617181920212223242526
  1. FIND_PACKAGE(PythonInterp 3 REQUIRED)
  2. FILE(GLOB test_cases "test_*.t")
  3. IF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
  4. FILE(GLOB test_cases_san "test-san_*.t")
  5. ENDIF()
  6. SET(PYTHON_VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/.venv")
  7. SET(PYTHON_VENV_PIP "${PYTHON_VENV_DIR}/bin/pip")
  8. SET(PYTHON_VENV_CRAM "${PYTHON_VENV_DIR}/bin/cram")
  9. ADD_CUSTOM_COMMAND(
  10. OUTPUT ${PYTHON_VENV_CRAM}
  11. COMMAND ${PYTHON_EXECUTABLE} -m venv ${PYTHON_VENV_DIR}
  12. COMMAND ${PYTHON_VENV_PIP} install cram
  13. )
  14. ADD_CUSTOM_TARGET(prepare-cram-venv ALL DEPENDS ${PYTHON_VENV_CRAM})
  15. ADD_TEST(
  16. NAME cram
  17. COMMAND ${PYTHON_VENV_CRAM} ${test_cases} ${test_cases_san}
  18. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  19. )
  20. SET_PROPERTY(TEST cram APPEND PROPERTY ENVIRONMENT "UCI_LUA=$<TARGET_FILE:uci_lua>")
  21. SET_PROPERTY(TEST cram APPEND PROPERTY ENVIRONMENT "BUILD_BIN_DIR=$<TARGET_FILE_DIR:uci>")