2018-03-26 18:19:39 +00:00
|
|
|
set(CATCH_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third_party)
|
|
|
|
add_library(Catch INTERFACE)
|
|
|
|
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
|
|
|
|
|
2018-03-30 20:12:54 +00:00
|
|
|
file(COPY "samples" DESTINATION "${PROJECT_BINARY_DIR}/test")
|
2018-10-20 17:17:35 +00:00
|
|
|
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/reports/")
|
2018-03-30 20:12:54 +00:00
|
|
|
|
2018-03-26 18:19:39 +00:00
|
|
|
file(GLOB files "src/unit-*.cpp")
|
|
|
|
foreach (file ${files})
|
|
|
|
get_filename_component(file_basename ${file} NAME_WE)
|
|
|
|
string(REGEX REPLACE "unit-([^$]+)" "test-\\1" testcase ${file_basename})
|
|
|
|
|
|
|
|
add_executable(${testcase} ${file})
|
2018-03-29 14:48:20 +00:00
|
|
|
set_target_properties(${testcase}
|
|
|
|
PROPERTIES
|
|
|
|
CXX_STANDARD 11
|
|
|
|
)
|
2018-03-26 18:19:39 +00:00
|
|
|
target_link_libraries(${testcase} Catch ${PROJECT_NAME})
|
2018-10-20 17:17:35 +00:00
|
|
|
add_test(${testcase} ${testcase} -s -r junit -o "${PROJECT_BINARY_DIR}/Testing/reports/${testcase}.xml")
|
2018-03-26 18:19:39 +00:00
|
|
|
endforeach()
|