# Target with multiple interfaces

**URL:** https://discourse.cmake.org/t/target-with-multiple-interfaces/957
**Category:** Usage
**Created:** [April 8, 2020, 10:33pm UTC](https://discourse.cmake.org/t/target-with-multiple-interfaces/957 "2020-04-08T22:33:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rpoisel](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rpoisel/32/190_2.png) [@rpoisel](https://discourse.cmake.org/u/rpoisel)
#### Post date: [April 8, 2020, 10:33pm UTC](https://discourse.cmake.org/t/target-with-multiple-interfaces/957/1 "2020-04-08T22:33:50Z")

</div>

I want to implement a CMake-based build system for the following architecture:

 ![arch](https://discourse.cmake.org/uploads/default/original/1X/d075758032b3896396ad1de13587505361ceb2a9.jpeg)  
As you can see: the `Model` component has two interfaces: `ModelRead` and `ModelEdit`.  
What is the preferred way to implement this architecture?

- Implementing `ModelEdit` and `ModelRead` as separate targets, e. g. `STATIC` libraries with `target_include_directories` set to `PUBLIC`? The `Model` component itself actually does not really exist as a dedicated target.
- Implementing the `Model` component as a `STATIC` library with `ModelEdit` and `ModelRead` being `INTERFACE` libraries that `target_link_libraries` to the `Model` target and having `INTERFACE` include directories containing the public headers/functions? The directories containing the public headers/functions are `target_include_directories` with the `PRIVATE` keyword to the `Model` 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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 9, 2020, 7:23pm UTC](https://discourse.cmake.org/t/target-with-multiple-interfaces/957/2 "2020-04-09T19:23:15Z")

</div>

Is `Model` actually two libraries? If so, the first is the better one. If it is one library, I recommend the second (though I suspect you may need to do some tweaking on the `target_include_directories(PRIVATE)`).
