Skip to content

Commit

Permalink
cmake: enable testing with CTests
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor Baker committed Jan 31, 2024
1 parent d6e0cf9 commit dd0259f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ target_compile_definitions(nanothread PRIVATE -DNANOTHREAD_BUILD=1)
set_target_properties(nanothread PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)

if (NANOTHREAD_ENABLE_TESTS)
add_subdirectory(tests)
include(CTest)
add_subdirectory(tests)
endif()

configure_file(nanothreadConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/nanothread/nanothreadConfig.cmake" COPYONLY)
Expand Down
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
add_executable(test_01 test_01.c)
target_link_libraries(test_01 PRIVATE nanothread)
add_test(NAME test_01 COMMAND test_01)

add_executable(test_02 test_02.cpp)
target_link_libraries(test_02 PRIVATE nanothread)
target_compile_features(test_02 PRIVATE cxx_std_11)
add_test(NAME test_02 COMMAND test_02)

add_executable(test_03 test_03.cpp)
target_link_libraries(test_03 PRIVATE nanothread)
target_compile_features(test_03 PRIVATE cxx_std_14)
add_test(NAME test_03 COMMAND test_03)

add_executable(test_04 test_04.cpp)
target_link_libraries(test_04 PRIVATE nanothread)
target_compile_features(test_04 PRIVATE cxx_std_11)
add_test(NAME test_04 COMMAND test_04)

0 comments on commit dd0259f

Please sign in to comment.