Skip to content

Commit da0962a

Browse files
author
Connor Baker
committed
cmake: enable testing with CTests
1 parent 8e553e9 commit da0962a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ target_compile_definitions(nanothread PRIVATE -DNANOTHREAD_BUILD=1)
7171
set_target_properties(nanothread PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
7272

7373
if (NANOTHREAD_ENABLE_TESTS)
74-
add_subdirectory(tests)
74+
include(CTest)
75+
add_subdirectory(tests)
7576
endif()
7677

7778
configure_file(nanothreadConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/nanothread/nanothreadConfig.cmake" COPYONLY)

tests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
add_executable(test_01 test_01.c)
22
target_link_libraries(test_01 PRIVATE nanothread)
3+
add_test(NAME test_01 COMMAND test_01)
34

45
add_executable(test_02 test_02.cpp)
56
target_link_libraries(test_02 PRIVATE nanothread)
67
target_compile_features(test_02 PRIVATE cxx_std_11)
8+
add_test(NAME test_02 COMMAND test_02)
79

810
add_executable(test_03 test_03.cpp)
911
target_link_libraries(test_03 PRIVATE nanothread)
1012
target_compile_features(test_03 PRIVATE cxx_std_14)
13+
add_test(NAME test_03 COMMAND test_03)
1114

1215
add_executable(test_04 test_04.cpp)
1316
target_link_libraries(test_04 PRIVATE nanothread)
1417
target_compile_features(test_04 PRIVATE cxx_std_11)
18+
add_test(NAME test_04 COMMAND test_04)

0 commit comments

Comments
 (0)