Skip to content

Commit

Permalink
cmake cache variable BLUETOE_BUILD_UNIT_TESTS added to exclude unit t…
Browse files Browse the repository at this point in the history
…ests from the default build #52
  • Loading branch information
TorstenRobitzki committed May 4, 2021
1 parent 86e2dc0 commit f58e376
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ script:
- mkdir build
- cd build
- /opt/cmake/bin/cmake --version
- /opt/cmake/bin/cmake -DCMAKE_CXX_COMPILER=$COMPILER -DBLUETOE_EXCLUDE_SLOW_TESTS=1 ..
- /opt/cmake/bin/cmake -DCMAKE_CXX_COMPILER=$COMPILER -DBLUETOE_EXCLUDE_SLOW_TESTS=1 -DBLUETOE_BUILD_UNIT_TESTS=1 ..
- make
- ctest --verbose

Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
project(lib_bluetoe CXX)

option(BLUETOE_BUILD_UNIT_TESTS "If true, unit test targets are added are build.")

add_library(bluetoe_iface INTERFACE)
target_compile_features(bluetoe_iface INTERFACE cxx_std_11)
add_library(bluetoe::iface ALIAS bluetoe_iface)
Expand Down
40 changes: 21 additions & 19 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,24 @@ function(bluetoe_add_test test_runner)
add_and_register_test(${test_runner} bluetoe::iface)
endfunction()

add_and_register_test(write_queue_tests)
add_and_register_test(service_tests)
add_and_register_test(options_tests)
add_and_register_test(characteristic_tests)
add_and_register_test(characteristic_value_tests)
add_and_register_test(advertising_tests)
add_and_register_test(filter_tests)
add_and_register_test(server_tests)
add_and_register_test(auto_uuid_tests)
add_and_register_test(scattered_access_tests)
add_and_register_test(gap_service_tests)
add_and_register_test(read_write_handler_tests)
add_and_register_test(encryption_tests)

add_subdirectory(att)
add_subdirectory(link_layer)
add_subdirectory(services)
add_subdirectory(security_manager)
add_subdirectory(hci)
if ( BLUETOE_BUILD_UNIT_TESTS )
add_and_register_test(write_queue_tests)
add_and_register_test(service_tests)
add_and_register_test(options_tests)
add_and_register_test(characteristic_tests)
add_and_register_test(characteristic_value_tests)
add_and_register_test(advertising_tests)
add_and_register_test(filter_tests)
add_and_register_test(server_tests)
add_and_register_test(auto_uuid_tests)
add_and_register_test(scattered_access_tests)
add_and_register_test(gap_service_tests)
add_and_register_test(read_write_handler_tests)
add_and_register_test(encryption_tests)

add_subdirectory(att)
add_subdirectory(link_layer)
add_subdirectory(services)
add_subdirectory(security_manager)
add_subdirectory(hci)
endif()

0 comments on commit f58e376

Please sign in to comment.