From de495fb8d69680f60a9dabca71e28c94b22b41fd Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 21 Dec 2020 12:40:47 +0100 Subject: test/direct_bt/CMakeList.txt: Use more fancy generic cmake recipe, add catch2 dependency (not done yet) --- test/direct_bt/CMakeLists.txt | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/direct_bt/CMakeLists.txt b/test/direct_bt/CMakeLists.txt index 87819fe3..45151d5c 100644 --- a/test/direct_bt/CMakeLists.txt +++ b/test/direct_bt/CMakeLists.txt @@ -4,18 +4,28 @@ include_directories( ${PROJECT_SOURCE_DIR}/api ) -add_executable (test_basictypes01 test_basictypes01.cpp) -target_link_libraries (test_basictypes01 direct_bt) -add_dependencies(test_basictypes01 direct_bt) -add_test (NAME basictypes01 COMMAND test_basictypes01) +# These examples use the standard separate compilation +set( SOURCES_IDIOMATIC_EXAMPLES + test_btaddress01.cpp + test_uuid.cpp + test_attpdu01.cpp +) + +string( REPLACE ".cpp" "" BASENAMES_IDIOMATIC_EXAMPLES "${SOURCES_IDIOMATIC_EXAMPLES}" ) +set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} ) + +foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} ) + add_executable(${name} ${name}.cpp) +endforeach() + +set(ALL_EXAMPLE_TARGETS + ${TARGETS_IDIOMATIC_EXAMPLES} +) -add_executable (test_uuid test_uuid.cpp) -target_link_libraries (test_uuid direct_bt) -add_dependencies(test_uuid direct_bt) -add_test (NAME uuid COMMAND test_uuid) +foreach(name ${ALL_EXAMPLE_TARGETS}) + target_link_libraries(${name} direct_bt catch2) + add_dependencies(${name} direct_bt catch2) + add_test (NAME ${name} COMMAND ${name}) +endforeach() -add_executable (test_attpdu01 test_attpdu01.cpp) -target_link_libraries (test_attpdu01 direct_bt) -add_dependencies(test_attpdu01 direct_bt) -add_test (NAME attpdu01 COMMAND test_attpdu01) -- cgit v1.2.3