Skip to content

Commit 556a006

Browse files
committed
CMake: add function add_streamutils_test()
1 parent 61342fa commit 556a006

11 files changed

Lines changed: 28 additions & 91 deletions

File tree

extras/test/CMakeLists.txt

Lines changed: 7 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -11,102 +11,19 @@ file(GLOB SOURCES CONFIGURE_DEPENDS *.cpp)
1111

1212
add_subdirectory(doctest)
1313

14-
#
15-
# AVR
16-
#
17-
add_subdirectory(cores/avr)
18-
19-
add_executable(StreamUtilsTestAvr ${SOURCES})
20-
target_link_libraries(StreamUtilsTestAvr AvrCore doctest)
14+
function(add_streamutils_test EXECUTABLE CORE)
15+
add_executable(${EXECUTABLE} ${SOURCES})
16+
target_link_libraries(${EXECUTABLE} ${CORE} doctest)
17+
add_test(${EXECUTABLE} ${EXECUTABLE})
18+
endfunction()
2119

22-
add_test(Avr StreamUtilsTestAvr)
23-
24-
#
25-
# ESP32
26-
#
20+
add_subdirectory(cores/avr)
2721
add_subdirectory(cores/esp32)
28-
29-
add_executable(StreamUtilsTestEsp32 ${SOURCES})
30-
target_link_libraries(StreamUtilsTestEsp32 Esp32Core doctest)
31-
32-
add_test(Esp32 StreamUtilsTestEsp32)
33-
34-
#
35-
# ESP8266
36-
#
3722
add_subdirectory(cores/esp8266)
38-
39-
add_executable(StreamUtilsTestEsp8266 ${SOURCES})
40-
target_link_libraries(StreamUtilsTestEsp8266 Esp8266Core doctest)
41-
42-
add_test(Esp8266 StreamUtilsTestEsp8266)
43-
44-
#
45-
# NRF52
46-
#
4723
add_subdirectory(cores/nrf52)
48-
49-
add_executable(StreamUtilsTestNrf52 ${SOURCES})
50-
target_link_libraries(StreamUtilsTestNrf52 Nrf52Core doctest)
51-
52-
add_test(Nrf52 StreamUtilsTestNrf52)
53-
54-
#
55-
# RP2040
56-
#
5724
add_subdirectory(cores/rp2040)
58-
59-
add_executable(StreamUtilsTestRp2040 ${SOURCES})
60-
target_link_libraries(StreamUtilsTestRp2040 Rp2040Core doctest)
61-
62-
add_test(Rp2040 StreamUtilsTestRp2040)
63-
64-
#
65-
# SAMD
66-
#
6725
add_subdirectory(cores/samd)
68-
69-
add_executable(StreamUtilsTestSamd ${SOURCES})
70-
target_link_libraries(StreamUtilsTestSamd SamdCore doctest)
71-
72-
add_test(Samd StreamUtilsTestSamd)
73-
74-
#
75-
# STM32 (Official core)
76-
#
7726
add_subdirectory(cores/stm32)
78-
79-
add_executable(StreamUtilsTestStm32 ${SOURCES})
80-
target_link_libraries(StreamUtilsTestStm32 Stm32Core doctest)
81-
82-
add_test(Stm32 StreamUtilsTestStm32)
83-
84-
#
85-
# STM32F1 (Roger's core)
86-
#
8727
add_subdirectory(cores/stm32f1)
88-
89-
add_executable(StreamUtilsTestStm32F1 ${SOURCES})
90-
target_link_libraries(StreamUtilsTestStm32F1 Stm32F1Core doctest)
91-
92-
add_test(Stm32F1 StreamUtilsTestStm32F1)
93-
94-
#
95-
# STM32F4 (Roger's core)
96-
#
9728
add_subdirectory(cores/stm32f4)
98-
99-
add_executable(StreamUtilsTestStm32F4 ${SOURCES})
100-
target_link_libraries(StreamUtilsTestStm32F4 Stm32F4Core doctest)
101-
102-
add_test(Stm32F4 StreamUtilsTestStm32F4)
103-
104-
#
105-
# Teensy
106-
#
107-
add_subdirectory(cores/teensy)
108-
109-
add_executable(StreamUtilsTestTeensy ${SOURCES})
110-
target_link_libraries(StreamUtilsTestTeensy TeensyCore doctest)
111-
112-
add_test(Teensy StreamUtilsTestTeensy)
29+
add_subdirectory(cores/teensy)

extras/test/cores/avr/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ target_compile_definitions(AvrCore
1919
PUBLIC
2020
ARDUINO_ARCH_AVR
2121
)
22+
23+
add_streamutils_test(StreamUtilsTestAvr AvrCore)

extras/test/cores/esp32/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ target_compile_definitions(Esp32Core
2525
target_compile_options(Esp32Core
2626
PUBLIC
2727
-funsigned-char
28-
)
28+
)
29+
30+
add_streamutils_test(StreamUtilsTestEsp32 Esp32Core)

extras/test/cores/esp8266/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ target_compile_definitions(Esp8266Core
1818
PUBLIC
1919
ARDUINO_ARCH_ESP8266
2020
)
21+
22+
add_streamutils_test(StreamUtilsTestEsp8266 Esp8266Core)

extras/test/cores/nrf52/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ target_compile_definitions(Nrf52Core
1414
INTERFACE
1515
ARDUINO_ARCH_NRF52
1616
)
17+
18+
add_streamutils_test(StreamUtilsTestNrf52 Nrf52Core)

extras/test/cores/rp2040/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ target_compile_definitions(Rp2040Core
1717
PUBLIC
1818
ARDUINO_ARCH_RP2040
1919
)
20+
21+
add_streamutils_test(StreamUtilsTestRp2040 Rp2040Core)

extras/test/cores/samd/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ target_compile_definitions(SamdCore
1414
INTERFACE
1515
ARDUINO_ARCH_SAMD
1616
)
17+
18+
add_streamutils_test(StreamUtilsTestSamd SamdCore)

extras/test/cores/stm32/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ target_compile_definitions(Stm32Core
2121
STM32_CORE_VERSION_MINOR=4
2222
STM32_CORE_VERSION_PATCH=0
2323
)
24+
25+
add_streamutils_test(StreamUtilsTestStm32 Stm32Core)

extras/test/cores/stm32f1/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ target_compile_definitions(Stm32F1Core
1414
INTERFACE
1515
ARDUINO_ARCH_STM32F1
1616
)
17+
18+
add_streamutils_test(StreamUtilsTestStm32F1 Stm32F1Core)

extras/test/cores/stm32f4/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ target_compile_definitions(Stm32F4Core
1515
INTERFACE
1616
ARDUINO_ARCH_STM32F4
1717
)
18+
19+
add_streamutils_test(SteamUtilsTestStm32F4 Stm32F4Core)

0 commit comments

Comments
 (0)