# INTERFACE library target and CXX\_MODULES file set

**URL:** https://discourse.cmake.org/t/interface-library-target-and-cxx-modules-file-set/15550
**Category:** Code
**Tags:** os:linux
**Created:** [March 10, 2026, 8:47am UTC](https://discourse.cmake.org/t/interface-library-target-and-cxx-modules-file-set/15550 "2026-03-10T08:47:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![matwey](https://discourse.cmake.org/user_avatar/discourse.cmake.org/matwey/32/198_2.png) [@matwey](https://discourse.cmake.org/u/matwey)
#### Post date: [March 10, 2026, 8:47am UTC](https://discourse.cmake.org/t/interface-library-target-and-cxx-modules-file-set/15550/1 "2026-03-10T08:47:01Z")

</div>

Hello,

I am completely confused with correct usage of C++ modules and INTERFACE targets. Let me please first describe what I currently have and what I want to achieve. I have a project consisting multiple firmwares for MCUs boards. Each firmware is written in C++26 and uses C++ modules. They also share common C++ source code which I want to logically separate and declare as a target.

However, the target can not be an OBJECT library since each MCU requires its own compilation flags (for instance, `-mcpu`). So, even being logically separate thing, the shared C++ source code must be recompiled each time for every firmware binary. There is INTERFACE target. But CXX\_MODULES is not allowed for INTERFACE. So I am stuck here.
