Debugging an errant -isystem

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.

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?

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.