# Supressing INTERFACE sources from showing up in downstream VS Sln libraries

**URL:** <https://discourse.cmake.org/t/supressing-interface-sources-from-showing-up-in-downstream-vs-sln-libraries/8329>\
**Category:** Code\
**Created:** [June 13, 2023, 9:01pm UTC](https://discourse.cmake.org/t/supressing-interface-sources-from-showing-up-in-downstream-vs-sln-libraries/8329 "2023-06-13T21:01:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwarwick](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dwarwick/32/2298_2.png) [@dwarwick](https://discourse.cmake.org/u/dwarwick)\
**Post date:** [June 13, 2023, 9:01pm UTC](https://discourse.cmake.org/t/supressing-interface-sources-from-showing-up-in-downstream-vs-sln-libraries/8329/1 "2023-06-13T21:01:10Z")

</div>

We use a third-party library with a lot of headers which a good amount of libraries in our codebase have a transitive dependency on (unfortunately). However, because the third-party library’s headers are INTERFACE sources, this makes the 200 or so headers from the third-party library show up in _every_ downstream target’s “Header Files” folder in VS Solutions.

We’ve made sure SYSTEM was set to TRUE in the third-party’s target settings & looked at setting the source\_group of all of the files to `_hidden` to collapse them at the very least, but neither help. SYSTEM is ignored when duplicating the 200 headers across every downstream target’s “Header Files” folder, and source\_group is specific to the directory it’s called in so it doesn’t apply to the downstream targets.

How can we prevent these sources from being duplicated to every downstream target’s “Header Files” folder?

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [June 15, 2023, 12:29pm UTC](https://discourse.cmake.org/t/supressing-interface-sources-from-showing-up-in-downstream-vs-sln-libraries/8329/2 "2023-06-15T12:29:37Z")

</div>

Since CMake 3.19, INTERFACE libraries can have sources specified in the call to `add_library()`, or sources can be added as PRIVATE with `target_sources()`. That will associate those headers with the INTERFACE library but not force them as transitive dependencies on anything linking to that INTERFACE library.

If you can convince the maintainers of the third party library to add the sources as described above (possibly behind a check for the CMake version), that’s the best outcome. If that isn’t an option, a workaround might be to read the `INTERFACE_SOURCES` property of that third party library target, copy that to the target’s `SOURCES` property, and then set its `INTERFACE_SOURCES` property to an empty string. I _think_ that’s going to give you the same end result as if the third party maintainer fixed their target, but you’d need to try it to confirm.
