Skip to content

Commit b1c4c44

Browse files
committed
CMake: Greentea test CMakeLists.txt refactoring
- Added the new CMake `MBED_TEST_LINK_LIBRARIES` command-line argument support to receive all dependent libraries for the particular greentea test suite. For example: - To select mbed-os library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-os - To select baremetal library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal - To select baremetal with external error logging library to the test with -D "MBED_TEST_LINK_LIBRARIES=mbed-baremetal ext-errorlogging"
1 parent dd33463 commit b1c4c44

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tools/cmake/mbed_greentea.cmake

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,17 @@ macro(mbed_greentea_add_test)
5555
${MBED_GREENTEA_TEST_SOURCES}
5656
)
5757

58-
if(MBED_BAREMETAL_GREENTEA_TEST)
59-
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-baremetal mbed-greentea)
60-
else()
61-
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-os mbed-greentea)
58+
# The CMake MBED_TEST_LINK_LIBRARIES command-line argument is to get greentea test all dependent libraries.
59+
# For example:
60+
# - To select mbed-os library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-os
61+
# - To select baremetal library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal
62+
# - To select baremetal with extra external error logging library to the test, use cmake with
63+
# -D "MBED_TEST_LINK_LIBRARIES=mbed-baremetal ext-errorlogging"
64+
if (DEFINED MBED_TEST_LINK_LIBRARIES)
65+
separate_arguments(MBED_TEST_LINK_LIBRARIES)
66+
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS ${MBED_TEST_LINK_LIBRARIES} mbed-greentea)
67+
else()
68+
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-greentea)
6269
endif()
6370

6471
target_link_libraries(${TEST_NAME}

0 commit comments

Comments
 (0)