[CMake] Cannot get automoc to work properly with recommended Qt5 support method

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Oct 20 20:24:46 EDT 2016


On 2016-10-20 12:27-0700 Alan W. Irwin wrote:

> One especially useful thing I realized from your post is my current
> use of a custom_target that depends on MOC_OUT (in your above
> nomenclature) is essentially a no-op since MOC_OUT is generated at
> CMake time rather then set up as a custom command to be run at build
> time.  So there is more cleanup I need to do of my explicit method.

Oops.  That comment is not correct.  If you look at the qt5_wrap_cpp
macro source (in my case in
/usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreMacros.cmake as
packaged by Debian Jessie), it creates a custom command.  So creating
a custom target (like I do in the PLplot build system) that DEPENDS on
MOC_OUT is completely appropriate.  However, that working direct
method is somewhat convoluted so I hope the issue with automoc failing
when the header is in a separate directory is solved in the future.
(See my recent cmake-devel thread where I have given a minimal example
of this sort of automoc failure for the cmake developers to ponder.
That example also has an option to use the direct qt5_wrap_cpp method
with custom target instead of automoc.  That option compiles the
example without problems but the automoc option fails to compile).

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list