# FetchContent\_Declare SYSTEM property for hierarchical dependencies

**URL:** https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198
**Category:** Usage
**Created:** [October 13, 2023, 12:49pm UTC](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198 "2023-10-13T12:49:27Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![psyinf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/psyinf/32/3914_2.png) [@psyinf](https://discourse.cmake.org/u/psyinf)
#### Post date: [October 13, 2023, 12:49pm UTC](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198/1 "2023-10-13T12:49:27Z")

</div>

Hi,

We’re currently using the SYSTEM property to ignore warnings for imported libraries (lets call them B,C,…) (via FetchContent) into a library A.  
This works very well, but when we are then consume library A in another project (also via FetchContent) the SYSTEM property is no longer working for the indirectly imported targets (B,C,…) , so the warnings appear again.

Is this intended? Or how can I consume library A using fetch\_content and prevent the warnings in the header files of B,C at this point?

```auto
FetchContent_Declare(
    libA
    GIT_REPOSITORY ...
    GIT_TAG ...
    SYSTEM #This still shows the warnings from libB,libC which are dependencies of libA
)

```

P.S. I’m using CMake 3.27.6  
Cheers  
Sebastian

---

<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: [October 13, 2023, 8:38pm UTC](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198/2 "2023-10-13T20:38:33Z")

</div>

Can you provide a complete, minimal pair of projects which demonstrate this? I can’t think of a reason why FetchContent would do that when used in the expected way, so I suspect there’s something about the way you’re using it which is causing the behavior you’re observing.

---

<div class="post-metadata">

### Author: ![psyinf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/psyinf/32/3914_2.png) [@psyinf](https://discourse.cmake.org/u/psyinf)
#### Post date: [October 23, 2023, 8:01pm UTC](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198/3 "2023-10-23T20:01:48Z")

</div>

Hi Craig,

Sorry for this taking a while. Basically [https://github.com/psyinf/cmake\_min\_consumer\_app.git](https://github.com/psyinf/cmake_min_consumer_app.git) and the minimal dependencies show what I suspect to be a misunderstanding of how the SYSTEM property is used. The minimal app includes the minConsumingLib which fetches the minLib. When I compile the App with SYSTEM set to the FetchDeclare of the minConsumingLib i still see warnings regarding the minLib headers.

Cheers  
Sebastian

---

<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: [October 26, 2023, 6:10am UTC](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198/4 "2023-10-26T06:10:24Z")

</div>

Thanks Sebastian, I can reproduce your problem. This isn’t actually a FetchContent issue. I’m able to reproduce the same problem without it. I’m currently reducing the project down to something minimal to narrow down the cause. Once I manage that, I’ll open a bug report and link back to here.

---

<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: [October 26, 2023, 7:19am UTC](https://discourse.cmake.org/t/fetchcontent-declare-system-property-for-hierarchical-dependencies/9198/5 "2023-10-26T07:19:32Z")

</div>

Issue opened here: [https://gitlab.kitware.com/cmake/cmake/-/issues/25364](https://gitlab.kitware.com/cmake/cmake/-/issues/25364)
