I want to implement a CMake-based build system for the following architecture:
As you can see: the
Model
component has two interfaces: ModelRead
and ModelEdit
.What is the preferred way to implement this architecture?
- Implementing
ModelEdit
andModelRead
as separate targets, e. g.STATIC
libraries withtarget_include_directories
set toPUBLIC
? TheModel
component itself actually does not really exist as a dedicated target. - Implementing the
Model
component as aSTATIC
library withModelEdit
andModelRead
beingINTERFACE
libraries thattarget_link_libraries
to theModel
target and havingINTERFACE
include directories containing the public headers/functions? The directories containing the public headers/functions aretarget_include_directories
with thePRIVATE
keyword to theModel
target. - Or maybe something completely different?
To keep things simple, targets can all be static libraries which are finally linked into an executable.
Thanks for your thoughts and ideas, Rainer