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.
pull/14773/head
Robert Walton 2021-06-11 22:06:49 +01:00
parent b73b38a01f
commit 021baa68e7
5 changed files with 6 additions and 2 deletions

View File

@ -48,5 +48,6 @@ target_link_libraries(mbed-stubs-connectivity
mbed-headers
mbed-stubs-headers
mbed-stubs-rtos
mbed-stubs-platform
gtest
)

View File

@ -46,7 +46,7 @@ target_link_libraries(mbed-stubs-cellular
PRIVATE
mbed-headers-base
mbed-headers-connectivity
mbed-headers-platform
mbed-stubs-platform
mbed-headers-rtos
mbed-headers-drivers
mbed-headers-hal

View File

@ -26,6 +26,10 @@ target_sources(mbed-stubs-platform
randLIB_stub.c
randLIB_stub.cpp
)
target_include_directories(mbed-stubs-platform
PUBLIC
.
)
target_link_options(mbed-stubs-platform
PRIVATE
--coverage
@ -35,5 +39,4 @@ target_link_libraries(mbed-stubs-platform
mbed-headers-base
mbed-headers-hal
mbed-headers-platform
mbed-stubs-headers
)