[cmake-developers] CMAKE_AUTOMOC, system include dirs and target include directories

Stephen Kelly steveire at gmail.com
Mon Mar 18 19:24:25 EDT 2013


Alexander Neundorf wrote:

> The comment to your commit is not really correct.
> 
> "The commit d2536579 (Automoc: fix regression #13667, broken build in
> phonon, 2012-11-19) changed Automoc to try to re-add the Qt header dir
> if it was stripped out as an implicit include from the moc command
> line."
> 
> This commit more or less doesn't matter, since the following commit

But it was part of the 2.8.10.2 release. The followup was not.

> acc22400 basically completey reverts it, i.e. it does not "go further",
> but does something differently:
> 
> "The follow-up commit acc22400 (Automoc: get include dirs without
>  stripping implicit include dirs off, 2012-12-07) went further by not
>  removing the implicit include dirs, if they were specified specifically
>  by the user."
> 
> Some patch before simply added all of the implicit include dirs for moc,
> but moc cannot handle that, it errors out on some files then.

That may be, but it seems no such commit was merged to master. The breakage 
you are referring to is probably 

 https://bugreports.qt-project.org/browse/QTBUG-28045

which was fixed before 5.0.0, so we could consider adding all implicit 
include dirs again.

> The order of include dirs when set via tll() is now probably the same as
> the order of the targets in tll() ?
> May we run into other situations where this can cause problems ?

Yes, but nothing new. 

If multiple projects install headers with the same unnamespaced name (eg 
engine.h) in their include directories, you might have changed 

 include_directories(${Foo_INCLUDES}
   ${Bar_INCLUDES}
 )

 include_directories(${Bar_INCLUDES}
   ${Foo_INCLUDES}
 )

before. Now you'd either change the order on the tll line, or if that's not 
possible, add 

 target_include_directories(thetarget PRIVATE 
   $<TARGET_PROPERTY:bar,INTERFACE_INCLUDE_DIRECTORIES>
 )

somewhere.

Thanks,

Steve.





More information about the cmake-developers mailing list