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

Stephen Kelly steveire at gmail.com
Thu Jul 25 12:22:08 EDT 2013


Matthew Woehlke wrote:

> On 2013-07-25 11:25, Stephen Kelly wrote:
>> Brad King wrote:
>>> On 07/25/2013 09:16 AM, Stephen Kelly wrote:
>>>> Should we treat the INTERFACE_INCLUDE_DIRECTORIES of all IMPORTED
>>>> targets as SYSTEM includes automatically?
>>>
>>> I don't think so because one could be importing targets from a
>>> dependency that was just built as part of a "superbuild" and may want to
>>> see the warnings.
>>
>> I considered that, but if you're building it as part of a superbuild,
>> you'll still get the warning when building the dependency itself.
> 
> Not necessarily; library A may provide a utility header that it doesn't
> actually use internally, and library B may use it and produce a warning.

Edge case. 

Even then, 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.

 https://qt.gitorious.org/qt/qtbase/blobs/dev/mkspecs/features/qt_headersclean.prf

> (Besides there is more chance of noticing a warning the more times it
> trips. For that matter, wouldn't this defeat the purpose in the original
> post of being able to include Qt as non-SYSTEM?)
 
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.

Thanks,

Steve.





More information about the cmake-developers mailing list