[cmake-developers] SYSTEM parameter in target_include_directories

Stephen Kelly steveire at gmail.com
Fri Jan 25 04:26:25 EST 2013


Stephen Kelly wrote:

> 
> Hi there,
> 
> I've just pushed tid-system-argument to my clone. It doesn't include unit
> tests yet, but I wonder if I can get it into 2.8.11?
> 

I looked into this a bit. The way SYSTEM include directories are marked is 
makefile-local, not target-local. 

That means that code like this would be confusing:

 add_library(foo ...)
 add_library(bar ...)

 target_include_directories(foo SYSTEM PRIVATE /sys/inc)
 # Warning: /sys/inc marked as a system include if used by
 # bar too.

On the other hand, 

 include_directories(SYSTEM /sys/inc)

adds /sys/inc as an include dir to all targets in the makefile, which might 
not be wanted. 

I think the best solution would be to refactor the way system includes are 
handled to be target-local instead of makefile-local and then add the patch. 
All that can be done in a future release.

Thanks,

Steve.





More information about the cmake-developers mailing list