[cmake-developers] linked-usage-cleanup regressed automoc
Alexander Neundorf
neundorf at kde.org
Thu Mar 14 13:43:49 EDT 2013
On Thursday 14 March 2013, Brad King wrote:
> On 03/13/2013 05:36 PM, Alexander Neundorf wrote:
> > On Wednesday 13 March 2013, Stephen Kelly wrote:
> >> I think Alex' objection is only related to thinking that the case of a
> >> header-only-library-with-automoc-generated-cxx-file should be an error.
> >
> > Yes, looks like it.
> > If this is really a feature (and not a bug), then this is probably
> > needed. I still think it's kind of strange.
> > I mean, this turns a header-only library, and for those I would expect
> > that it was a deliberate decision to make it header-only, into a normal
> > link library.
>
> There is no such thing as a header-only add_library. It would have no
> link language or objects and CMake would not generate. The point is to
> support a header-only Qt library where the moc part is the only source
> of C++ code.
Yes.
> > Also, at least in theory, it could be a C (and not C++) header-only
> > library, which would then turn into C++.
>
> Don't set the AUTOMOC property on the target if you don't want it.
Yes, there's no problem with this.
It's the global
set(CMAKE_AUTOMOC ON)
which may have unexpected effects.
> > Really, who is using this ?
>
> If no one was using it I wouldn't have started this thread and
> this discussion wouldn't be happening (yet). It was in one of Kitware's
> other projects but I don't remember which one. Since then they've
> stopped using this though and moved the header into another library that
> also has real sources.
>
> However, since it worked in 2.8.10 others could be using it so it will
> take a post-2.8.11 policy to drop it.
Well, if this is indeed used, I don't feel like removing it :-)
Would you object a check that if a target has at least one C or Fortran source
file, but no C++ source file, it should skipped for automoc ?
Alex
More information about the cmake-developers
mailing list