Commit | Line | Data |
---|---|---|
a87a0712 TJ |
1 | # Optional unit test |
2 | ||
3 | find_package(Boost COMPONENTS unit_test_framework) | |
4 | ||
5 | if(Boost_UNIT_TEST_FRAMEWORK_FOUND) | |
6 | ||
7 | message(STATUS "Building unit test") | |
8 | ||
9 | enable_testing() | |
10 | ||
11 | INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/src) | |
12 | ||
13 | set(cpp_tests | |
14 | basic.cpp | |
15 | baudrate.cpp | |
16 | ) | |
17 | ||
18 | add_executable(test_libftdi ${cpp_tests}) | |
19 | target_link_libraries(test_libftdi ftdi ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) | |
20 | ||
21 | add_test(test_libftdi test_libftdi) | |
22 | ||
23 | # Add custom target so we run easily run "make check" | |
24 | add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS test_libftdi) | |
25 | ||
26 | else(Boost_UNIT_TEST_FRAMEWORK_FOUND) | |
27 | ||
28 | message(STATUS "NOT building unit test (requires boost unit test framework)") | |
29 | ||
30 | endif(Boost_UNIT_TEST_FRAMEWORK_FOUND) |