[cmake-developers] QtAutogen suggestions
Brad King
brad.king at kitware.com
Mon Nov 28 09:57:55 EST 2016
On 11/25/2016 05:37 PM, Sebastian Holtermann wrote:
> There are some issues with QtAutogen that still bother me and
> that I would like to change.
Great! We currently have no dedicated maintainer for it and I have
little understanding of the tools and use cases associated with it
myself. It will be useful to have your help.
> 1) Most files get generated in
> ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}_automoc.dir
>
> Is the ".dir" suffix neccessary? I think is should be removed.
That suffix is the convention used for all intermediate files
(e.g. object files) associated with a particular target of any kind.
The _automoc targets are simply following that convention, but there
is no strong reason this has to be the case for the generated sources.
> 2) Moc files that are manually included by a
> #include "moc_<basename>.cpp"
> statement get generated in ${CMAKE_CURRENT_BINARY_DIR}
>
> A better solution would be to generate the moc_<basename>.cpp files in
> ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}_automoc/include.
> AUTOMOC then should automatically add that directory to the
> INCLUDE_DIRECTORIES of the origin target.
Yes, I think that has been discussed before but no one ever implemented it.
> 3) The mocs compilation file currently gets generated as
> ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}_automoc.cpp
>
> The file could be generated as
> ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}_automoc/compilation.cpp
Okay.
> 4) AUTOMOC AUTOUIC and AUTORCC perform different independent tasks that
> in the current implementation get processed serially inside a single
> custom target named ${TARGETNAME}_automoc.
>
> I think each of the three could be handled in an own target.
In VS IDE and Xcode each target becomes another user-visible entity so
we try to keep generated targets to a minimum. IIRC in some cases we
even try to use a PRE_BUILD step in the VS targets to avoid an extra
target altogether. The breakdown could be made generator-specific
to improve behavior on Ninja and Makefile generators. In the case that
a common target is needed it could be renamed to `_autogen` instead.
Thanks,
-Brad
More information about the cmake-developers
mailing list