# Debugging an errant -isystem

**URL:** https://discourse.cmake.org/t/debugging-an-errant-isystem/5250
**Category:** Code
**Tags:** os:macos, comp:clang, gen:makefiles
**Created:** [March 19, 2022, 5:53pm UTC](https://discourse.cmake.org/t/debugging-an-errant-isystem/5250 "2022-03-19T17:53:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dcblack](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dcblack/32/2175_2.png) [@dcblack](https://discourse.cmake.org/u/dcblack)
#### Post date: [March 19, 2022, 5:53pm UTC](https://discourse.cmake.org/t/debugging-an-errant-isystem/5250/1 "2022-03-19T17:53:16Z")

</div>

I have a project that keeps insisting on putting in a **-isystem** _DIRECTORY_, where the directory is completely inappropriate (it points to a directory is not relevant that is from another project elsewhere on my machine) and I have no idea why or how to get rid of it.

I searched all the files in my project, and find no hint of this directory. I also searched environment variables.

When I run ‘cmake --build build’ it suddenly shows up. I get a compiler error:

> gmake[2]: \*\*\* No rule to make target ‘/Volumes/eda/osci/src/lwg/build/cmake-debug/src/libsystemc.2.4.0\_pub\_rev\_20191203.dylib’, needed by ‘reporting’. Stop.

Where does the cmake get its instructions for this?

I’ve read various the “Use of -isystem” but it does not talk about how to remove these.

---

<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: [March 21, 2022, 3:03am UTC](https://discourse.cmake.org/t/debugging-an-errant-isystem/5250/2 "2022-03-21T03:03:04Z")

</div>

You should be able to use `cmake --trace-expand .` to get logging of all the code CMake sees with variables expanded. If it’s not there, are you using some toolchain file?

---

<div class="post-metadata">

### Author: ![dcblack](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dcblack/32/2175_2.png) [@dcblack](https://discourse.cmake.org/u/dcblack)
#### Post date: [March 21, 2022, 11:07am UTC](https://discourse.cmake.org/t/debugging-an-errant-isystem/5250/3 "2022-03-21T11:07:30Z")

</div>

No special toolchain.

Thank you. That helped me to track down the issue; although, I also found another helpful switch: --debug-find that provided more focussed information on what find\_package was doing.
