Skip to content

Commit d47720f

Browse files
committed
Refactoring CMakeLists.txt by introducing variables holding the various test sources
1 parent ca37b6c commit d47720f

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

extras/test/CMakeLists.txt

+18-6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
2222

2323
##########################################################################
2424

25-
set(TEST_TARGET testArduinoIoTCloud)
25+
set(TEST_TARGET ${CMAKE_PROJECT_NAME})
2626

27-
set(TEST_SRCS
28-
src/Arduino.cpp
29-
30-
src/test_main.cpp
27+
##########################################################################
3128

29+
set(TEST_SRCS
3230
src/test_OTALogic.cpp
3331

3432
src/test_addPropertyReal.cpp
@@ -42,10 +40,14 @@ set(TEST_SRCS
4240
src/test_publishOnChangeRateLimit.cpp
4341
src/test_readOnly.cpp
4442
src/test_writeOnly.cpp
43+
)
4544

45+
set(TEST_UTIL_SRCS
4646
src/util/CBORTestUtil.cpp
4747
src/util/OTATestUtil.cpp
48+
)
4849

50+
set(TEST_DUT_SRCS
4951
../../src/utility/ota/crc.cpp
5052
../../src/utility/ota/OTALogic.cpp
5153

@@ -65,6 +67,16 @@ set(TEST_SRCS
6567

6668
##########################################################################
6769

70+
set(TEST_TARGET_SRCS
71+
src/Arduino.cpp
72+
src/test_main.cpp
73+
${TEST_SRCS}
74+
${TEST_UTIL_SRCS}
75+
${TEST_DUT_SRCS}
76+
)
77+
78+
##########################################################################
79+
6880
add_compile_definitions(HOST)
6981
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
7082

@@ -75,7 +87,7 @@ set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--coverage")
7587

7688
add_executable(
7789
${TEST_TARGET}
78-
${TEST_SRCS}
90+
${TEST_TARGET_SRCS}
7991
)
8092

8193
##########################################################################

0 commit comments

Comments
 (0)