[CMake] Using Qt5 with CMake

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Mar 15 03:40:10 EDT 2014


Hi Steve:

If you remember my OP, I don't (yet) have access to Qt5 myself, but
another PLplot developer does, and after I changed the Qt relevant
part of our build system following the helpful advice I got on this
list, he was able to refine my work so that PLplot now produces good
"qt" PLplot device driver results for him with either Qt4 or Qt5.

We are very happy with those good build and run-time results for Qt5
that have been obtained by a combination of find_package,
qt5_use_modules, and qt5_wrap_cpp.  Furthermore, from the
documentation at
http://doc-snapshot.qt-project.org/qt5-stable/cmake-manual.html, it
appears this combination should work OK for CMake version 2.8.9 (our
minimum version) and above.  But the implication of that documentation
is that qt5_wrap_cpp is a rather dated approach (only mentioned in the
2.8.3 section of that documentation), and ultimately it would be
better to use the AUTOMOC target property instead for the relevant
targets.  However, that approach only seems to be mentioned for
CMake-2.8.11 section of the Qt5 CMake manual. Yet I double-checked the
actual documentation at
http://www.cmake.org/cmake/help/v2.8.9/cmake.html, and there does seem
to be an AUTOMOC target property available for 2.8.9.  So is that
property for that version of CMake not suitable for working with Qt5
as implied by the Qt5 CMake manual or could we safely move to the
AUTOMOC property approach even for our users that are still using
2.8.9? If the former is the case, then the part of the QT5 cmake
manual devoted to 2.8.9 needs to mention qt5_wrap_cpp, and if the
latter is the case that part of the manual needs to mention the
AUTOMOC property.

Of course, the question about qt5_wrap_cpp versus AUTOMOC property for
CMake-2.8.9 become moot once we update our minimum CMake version to
2.8.11, but that may be as much as a year away.

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