CMakeLists.txt 1.2 KB

123456789101112131415161718192021222324252627
  1. file(GLOB TEST_C_FILES "test_*.c")
  2. foreach(TEST_C_FILE ${TEST_C_FILES})
  3. get_filename_component(TEST_C_EXE ${TEST_C_FILE} NAME_WE)
  4. add_executable(${TEST_C_EXE} $<TARGET_OBJECTS:ERUTA_OBJECTS> ${TEST_C_FILE})
  5. target_link_libraries(${TEST_C_EXE} ${ERUTA_LIBS})
  6. add_test(${TEST_C_EXE} ${CMAKE_BINARY_DIR}/bin/${TEST_C_EXE})
  7. # Make sure that ctest shows the test error messages if there are any.
  8. set(CMAKE_CTEST_OPTIONS --output-on-failure)
  9. endforeach(TEST_C_FILE)
  10. file(GLOB TEST_BF_FILES "bf/test_*.c")
  11. foreach(TEST_BF_FILE ${TEST_BF_FILES})
  12. get_filename_component(TEST_BF_EXE ${TEST_BF_FILE} NAME_WE)
  13. add_executable(${TEST_BF_EXE} $<TARGET_OBJECTS:ERUTA_OBJECTS> ${TEST_BF_FILE})
  14. target_link_libraries(${TEST_BF_EXE} ${ERUTA_LIBS})
  15. add_test(${TEST_BF_EXE} ${CMAKE_BINARY_DIR}/bin/${TEST_BF_EXE})
  16. message(STATUS "For ${TEST_BF_FILE} : ${TEST_BF_EXE}")
  17. # Make sure that ctest shows the test error messages if there are any.
  18. set(CMAKE_CTEST_OPTIONS --output-on-failure)
  19. endforeach(TEST_BF_FILE)
  20. # Make check compiles the tests and runs them immediately.
  21. # add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} ${CMAKE_CTEST_OPTIONS} DEPENDS ${TEST_EXE})