Skip to content

Commit 021baa6

Browse files
committed
CMake: unit-tests: Split platform headers out of mbed-stubs-headers
We have a central collection of "stub headers", which makes reasoning about dependencies rather difficult, as it forces every stub library to depend on all available stub headers. The standard approach would be for each stub library to expose its public headers, and its dependents to explicitly specify a dependency on the stub library containing the headers it needs. This is a more modular design than creating a header-only monolith library. Move the platform stub headers from this central library into the mbed-stubs-platform library to increase modularity. mbed-stubs-connectivity now depends on the mbed-stubs-platform because it requires some headers which were moved to mbed-stubs-platform.
1 parent b73b38a commit 021baa6

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

UNITTESTS/stubs/connectivity/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ target_link_libraries(mbed-stubs-connectivity
4848
mbed-headers
4949
mbed-stubs-headers
5050
mbed-stubs-rtos
51+
mbed-stubs-platform
5152
gtest
5253
)

connectivity/cellular/tests/UNITTESTS/doubles/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ target_link_libraries(mbed-stubs-cellular
4646
PRIVATE
4747
mbed-headers-base
4848
mbed-headers-connectivity
49-
mbed-headers-platform
49+
mbed-stubs-platform
5050
mbed-headers-rtos
5151
mbed-headers-drivers
5252
mbed-headers-hal

platform/tests/UNITTESTS/doubles/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ target_sources(mbed-stubs-platform
2626
randLIB_stub.c
2727
randLIB_stub.cpp
2828
)
29+
target_include_directories(mbed-stubs-platform
30+
PUBLIC
31+
.
32+
)
2933
target_link_options(mbed-stubs-platform
3034
PRIVATE
3135
--coverage
@@ -35,5 +39,4 @@ target_link_libraries(mbed-stubs-platform
3539
mbed-headers-base
3640
mbed-headers-hal
3741
mbed-headers-platform
38-
mbed-stubs-headers
3942
)

0 commit comments

Comments
 (0)