diff options
| author | Kamil Cukrowski <[email protected]> | 2021-05-18 16:14:14 +0200 |
|---|---|---|
| committer | Kamil Cukrowski <[email protected]> | 2021-08-21 02:17:12 +0200 |
| commit | e7fbf378f9786c92b9e241767d10685f465876fe (patch) | |
| tree | 345d832bcb5737a79332b0733bfddb6309fcd6cf /CMakeLists.txt | |
| parent | fdcccab327f45bb5cabb232b0e25f06748b7ee80 (diff) | |
| download | STC-modified-e7fbf378f9786c92b9e241767d10685f465876fe.tar.gz STC-modified-e7fbf378f9786c92b9e241767d10685f465876fe.zip | |
cmake: Add examples as tests
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 10 |
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() |
