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-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})
|
|
|
|
add_test(${testcase} ${testcase})
|
|
|
|
endforeach()
|