You are referring to Clang 3.5 documentation. In Clang 3.4 User's Manual this option is called -isystem-prefix
. The option was renamed to --system-header-prefix
in r204775, 2.5 months after 3.4 release.
So you have to use -isystem-prefix
option, but it's not explained that it's cc1
option, so you have to use it like
clang -I ./nested -Xclang -isystem-prefix -Xclang legacyLib/ test.c
-Xclang
is used to pass the next option to cc1
. By the way, I've noticed that warnings aren't suppressed if legacyLib/
is in the same directory as test.c
. I don't know if it's a bug, but if you disagree with me, please file a bug report. The previous command works with the following directory structure
<working directory>
|- test.c, which has #include "legacyLib/header.h"
`- nested/
`- legacyLib/
`- header.h, which has warnings
For the future reference, Clang 3.5 supports --system-header-prefix
, i.e. the following command works (checked with clang version 3.5.0 (trunk 207361))
clang -I ./nested --system-header-prefix legacyLib/ test.c