[CMake] Precedence of SYSTEM and non-SYSTEM include directories

Jonathan Bohren jonathan.bohren at gmail.com
Tue Feb 9 13:04:23 EST 2016


I ran into a problem recently where a project I was building set a SYSTEM
include directory which was already a non-SYSTEM include directory imported
from a dependency. When this happened, CMake dropped the non-SYSTEM
directory in favor of the SYSTEM one, causing my build to fail.

Should this be the correct behavior? According to GCC [1], it gives
precedence to non-SYSTEM include directories, and specifying both for the
same path produces a warning. With CMake, if both are specified, it ignores
the non-SYSTEM include and fails silently. Should CMake be dropping one of
the options at all?

I've created a minimal example here:
http://github.com/jbohren/isystem

Thanks!
-j

[1] https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
> All directories named by -isystem are searched after all directories
named by -I, no matter what their order was on the command line. If the
same directory is named by both -I and -isystem, the -I option is ignored.
GCC provides an informative message when this occurs if -v is used.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160209/45c441b0/attachment.html>


More information about the CMake mailing list