Sat, 09 Apr 2022 16:37:43 +0200
#168 - add attributes and const
universe@391 | 1 | message(CHECK_START "Searching for CUnit test framework") |
universe@390 | 2 | |
universe@391 | 3 | find_path(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h) |
universe@391 | 4 | find_library(CUNIT_LIBRARY NAMES cunit libcunit cunitlib) |
universe@391 | 5 | include(FindPackageHandleStandardArgs) |
universe@391 | 6 | find_package_handle_standard_args(CUnit DEFAULT_MSG CUNIT_LIBRARY CUNIT_INCLUDE_DIR) |
universe@391 | 7 | |
universe@391 | 8 | if(CUNIT_FOUND) |
universe@391 | 9 | message(CHECK_PASS "found: compiling tests.") |
universe@391 | 10 | set(TESTS |
universe@391 | 11 | test_allocator |
universe@413 | 12 | test_list |
olaf@425 | 13 | test_tree |
universe@391 | 14 | ) |
universe@391 | 15 | |
universe@391 | 16 | foreach(test ${TESTS}) |
universe@422 | 17 | add_executable(${test} util_allocator.c ${test}.c) |
universe@391 | 18 | target_link_libraries(${test} PRIVATE ucx_static ${CUNIT_LIBRARY}) |
universe@395 | 19 | target_include_directories(${test} PRIVATE ${CUNIT_INCLUDE_DIR}) |
universe@391 | 20 | add_test(NAME ${test} COMMAND ${test} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") |
universe@391 | 21 | endforeach() |
universe@391 | 22 | else() |
universe@391 | 23 | message(CHECK_FAIL "not found: unit tests will not be available.") |
universe@391 | 24 | endif() |