Skip to content

Commit 9429312

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 911b348 commit 9429312

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

UNITTESTS/stubs/connectivity/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ target_link_libraries(mbed-stubs-connectivity
6262
mbed-headers
6363
mbed-stubs-headers
6464
mbed-stubs-rtos
65+
mbed-stubs-platform
6566
gtest
6667
)

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)