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

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Oct 20 15:27:13 EDT 2016


On 2016-10-20 13:48-0500 Steve Lorimer wrote:

> Sounds like you have ended up at the same solution I did. I had trouble
> getting the automated qt generation working, and in the end I made it
> explicit
>
> if(ARG_MOC)
> qt5_wrap_cpp(MOC_OUT ${ARG_MOC})
> endif()
> if(ARG_RES)
> qt5_add_resources(RES_OUT ${ARG_RES})
> endif()
> if(ARG_UI)
> qt5_wrap_ui(UI_OUT ${ARG_UI})
> endif()
>
> add_library(
> ${ARG_NAME}
> ${LINK}
> ${ARG_SRCS} ${MOC_OUT} ${RES_OUT} ${UI_OUT}
> )

Hi Steve:

Thanks for your additional comment.

Yes, I agree explicit is always a good fallback when automatic doesn't
work, but I am hoping the indirect result of this discussion is the
CMake developers will remove the limitations and deficiencies of the
automatic methods supporting Qt5 so they are a lot more useful for
complex real-world software projects.

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.

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