CMakeLists.txt 657 B

12345678910111213141516171819202122
  1. # @szdytom favored testing, set BUILD_TESTING to enable it
  2. # You can use scripts/run_tests.py as an alternative
  3. # Note: the CI uses scripts/run_tests.py to run the tests
  4. cmake_minimum_required(VERSION 3.10)
  5. function(pkpy_add_test pyfile)
  6. get_filename_component(test_name ${pyfile} NAME_WE)
  7. add_test(
  8. NAME ${test_name}
  9. COMMAND $<TARGET_FILE:main> ${pyfile}
  10. WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/..
  11. )
  12. endfunction()
  13. message("Testing enabled")
  14. file(GLOB PK_PYTHON_TESTCASES_FILES RELATIVE ${CMAKE_CURRENT_LIST_DIR}/.. "*.py")
  15. foreach(pyfile ${PK_PYTHON_TESTCASES_FILES})
  16. pkpy_add_test(${pyfile})
  17. endforeach()