summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKamil Cukrowski <[email protected]>2021-05-18 16:14:14 +0200
committerKamil Cukrowski <[email protected]>2021-08-21 02:17:12 +0200
commite7fbf378f9786c92b9e241767d10685f465876fe (patch)
tree345d832bcb5737a79332b0733bfddb6309fcd6cf /CMakeLists.txt
parentfdcccab327f45bb5cabb232b0e25f06748b7ee80 (diff)
downloadSTC-modified-e7fbf378f9786c92b9e241767d10685f465876fe.tar.gz
STC-modified-e7fbf378f9786c92b9e241767d10685f465876fe.zip
cmake: Add examples as tests
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1787154f..e7510343 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,4 +3,14 @@ project(stc)
add_library(stc INTERFACE)
target_include_directories(stc INTERFACE include)
+include(CTest)
+if(BUILD_TESTING)
+ file(GLOB examples examples/*.c)
+ foreach(file IN LISTS examples)
+ get_filename_component(name "${file}" NAME_WE)
+ add_executable(${name} ${file})
+ target_link_libraries(${name} PRIVATE stc m)
+ add_test(NAME ${name} COMMAND ${name})
+ endforeach()
+endif()