Skip to content

Commit b959023

Browse files
Connor Bakerjeongseok-meta
authored andcommitted
cmake: enable testing with CTests
1 parent 45a0020 commit b959023

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
@@ -78,7 +78,8 @@ target_compile_definitions(nanothread PRIVATE -DNANOTHREAD_BUILD=1)
7878
set_target_properties(nanothread PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
7979

8080
if (NANOTHREAD_ENABLE_TESTS)
81-
add_subdirectory(tests)
81+
include(CTest)
82+
add_subdirectory(tests)
8283
endif()
8384

8485
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)