[CMake] Using Qt5 with CMake

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Mar 12 11:58:58 EDT 2014


On 2014-03-12 01:15-0400 Jean-Christophe Fillion-Robin wrote:

> Hi Alan,
>
> To get a better idea of the required change to support Qt5, you could look
> at what we did for VTK. See
> https://github.com/Kitware/VTK/commit/384636ec9f4
>
> Hth
> Jc

Hi Jean-Christophe:

Thanks!  That is a big help.  I notice, for example, that VTK decided to
use the "Using Qt 5 with CMake older than 2.8.9" approach.  I might
try that as well to start because it seems more understandable to me
than the alternative approaches that are also available with later
CMake versions which take advantage of new CMake infrastructure.

Alan

>
>
> On Tue, Mar 11, 2014 at 4:59 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca>wrote:
>
>> On 2014-01-26 17:36+0100 Stephen Kelly wrote:
>>
>>  http://doc-snapshot.qt-project.org/qt5-stable/cmake-manual.html
>>>
>>
>> To resurrect this slightly old thread, it has been years since I
>> implemented the Qt4 parts of the PLplot build system, and I haven't
>> looked much at the Qt components of our build system ever since.  So I
>> am basically starting again from virtually no knowlege concerning
>> CMake support for Qt to get the PLplot build system to find and use
>> the Qt5 components that it needs.  I am frankly somewhat lost trying
>> to use the above documentation which seems rather incomplete from my
>> perspective.  Another complicating factor at the moment is I don't
>> have access to Qt5 (running Debian stable) so, for now, I don't have a
>> chance to try some experiments to work things out, and others (who
>> have considerably less general knowledge than I do concerning the
>> PLplot build system) will be trying out what is recommended here
>> instead of me.
>>
>> So here are some specific questions related to PLplot's future Qt5 needs.
>>
>> (1) How should you replace
>>
>> find_package(Qt4 4.8.2 COMPONENTS QtCore QtGui QtSvg)
>>
>> and
>>
>> qt4_wrap_cpp(
>>   QT_MOC_OUTFILES
>>   ${CMAKE_SOURCE_DIR}/include/qt.h
>>   OPTIONS ${MOC_OPTIONS}
>>   )
>>
>> (the two key commands the PLplot build system currently uses for Qt4)
>> with the new cmake finding infrastructure documented above?
>> (MOC_OPTIONS are some macros we set to control including or dropping
>> various parts of the PLplot qt.h header file.)
>>
>> (2) PLplot currently does not use include(${QT_USE_FILE}) since in my
>> view that directory property approach is too blunt an instrument that
>> tends to contaminate the large parts of the PLplot build that have
>> nothing to do with Qt with all the Qt-related compiler flags. Instead,
>> we use the alternative approach of simply setting the appropriate Qt
>> compile flags for our specific Qt-related source files.  Does Qt5
>> still use that directory property apprach for setting compile flags
>> or is this no longer an issue?
>>
>> (3) Our current alternative to include(${QT_USE_FILE}) still sets
>> QT_LIBRARIES.  That allows us to link one of the key PLplot Qt-related
>> libraries
>> as follows:
>>
>> target_link_libraries(
>>   plplotqt${LIB_TAG}
>>   plplot${LIB_TAG}
>>   ${MATH_LIB}
>>   ${QT_LIBRARIES}
>>   )
>>
>> How should that command be replaced for the new Qt5 way of doing
>> things?
>>
>> It appears from the above documentation that the new Qt5 find and use
>> methods are quite dependent on CMake version so assume for the
>> purposes of this question that our build system will force the PLplot
>> user to use CMake version 2.8.11 or higher by the time we have this
>> all debugged.
>>
>> Thanks in advance for any help you can give with the specific
>> questions above for converting a project such as PLplot that currently
>> uses Qt4 to one that uses Qt5.
>>
>> 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
>> __________________________
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/
>> opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
>
>
> -- 
> +1 919 869 8849
>

__________________________
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