# using \`-isystem\` flag

**URL:** <https://discourse.cmake.org/t/using-isystem-flag/10044>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [February 9, 2024, 3:04pm UTC](https://discourse.cmake.org/t/using-isystem-flag/10044 "2024-02-09T15:04:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Brixton](https://discourse.cmake.org/user_avatar/discourse.cmake.org/david_brixton/32/4292_2.png) [@David\_Brixton](https://discourse.cmake.org/u/David_Brixton)\
**Post date:** [February 9, 2024, 3:04pm UTC](https://discourse.cmake.org/t/using-isystem-flag/10044/1 "2024-02-09T15:04:49Z")

</div>

**What I want to do:**  
Disable warnings generated by external libraries while using CMake.

**Details:**  
I’m using cmake to compile my OpenCV project. But OpenCV throws a lot of warnings. When I’m compiling the project from command line by adding `-isystem` before the OpenCV include path, the warnings get disabled. But I don’t know how to do the same in CMakeLists.txt. Everything I have tried hasn’t worked so far. How do I do it?

---

<div class="post-metadata">

**Author:** ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Post date:** [February 9, 2024, 5:27pm UTC](https://discourse.cmake.org/t/using-isystem-flag/10044/2 "2024-02-09T17:27:37Z")

</div>

That depends on how you use the external Projekt?

---

<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:** [February 17, 2024, 5:59am UTC](https://discourse.cmake.org/t/using-isystem-flag/10044/3 "2024-02-17T05:59:03Z")

</div>

If you use variables:

```cmake
target_include_directories(mytgt SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS})

```

If you use targets, it should be done automatically for `IMPORTED` targets, though [`CMAKE_NO_SYSTEM_FROM_IMPORTED`](https://cmake.org/cmake/help/latest/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.html) can change that.
