[cmake-developers] target_link_libraries, IMPORTED targets and SYSTEM includes

Stephen Kelly steveire at gmail.com
Thu Jul 25 13:25:53 EDT 2013


Brad King wrote:

> On 07/25/2013 12:22 PM, Stephen Kelly wrote:
>> library A should have a unit test which attempts to compile all
>> of its headers with all warnings enabled. In Qt every module has a
>> 'headersclean' unit test which does exactly that.
> 
> While this is a good idea we're not going to assume every project has
> such discipline.  Also some consumers may include headers with a
> different preprocessing context that exposes the warning.

Right. Even if all headers are used by the upstream itself, this still 
applies. However, I still think IMPORTED=SYSTEM by *default* is a good idea, 
and let the edge case switch it back. I'm not seeing support for it though, 
so I guess I'll drop it.

>> The purpose in the bug report is not to include Qt as non-SYSTEM, but the
>> opposite. I don't see any reason for downstreams to include Qt headers as
>> non-SYSTEM headers.
> 
> Then why not make INTERFACE_SYSTEM_INCLUDE_DIRECTORIES the default in
> the Qt imported targets and have a switch to turn them off?  The code
> 
>  set(QT_INCLUDE_DIRS_NO_SYSTEM 1)
>  find_package(Qt5Core)
> 
> is not so bad in the edge case that needs it.

I don't like it though :). I'd prefer not to have any variables that change 
the behavior of a find_package call, so that only one find_package is ever 
needed, not multiple in different directories for scope.

> Either way, the tll() SYSTEM option could still be useful.

I'll add that tomorrow.

Thanks,

Steve.





More information about the cmake-developers mailing list