summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-12-21 12:40:47 +0100
committerSven Gothel <[email protected]>2020-12-21 12:40:47 +0100
commitde495fb8d69680f60a9dabca71e28c94b22b41fd (patch)
treef6035b796e988e5a2186256b0acc12fedb3b1449 /test
parente56940759c4f29f31cc29c67c05e12a9fc836db2 (diff)
test/direct_bt/CMakeList.txt: Use more fancy generic cmake recipe, add catch2 dependency (not done yet)
Diffstat (limited to 'test')
-rw-r--r--test/direct_bt/CMakeLists.txt34
1 files changed, 22 insertions, 12 deletions
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)