FindQt5.cmake?

Alexander Neundorf neundorf at kde.org
Thu Mar 7 20:57:03 UTC 2013


On Thursday 07 March 2013, Boudewijn Rempt wrote:
> Erm... I'm looking into Qt5 and KF5 atm, and I was wondering where I could
> find a FindQt5.cmake module, feeling rather lost.

You don't need one.
Qt5 installs cmake's Config.cmake files, which find_package() searches too.

So if you do 
find_package(Qt5Core)
cmake will search also for a Qt5CoreConfig.cmake file (in all of 
CMAKE_PREFIX_PATH) and load and execute it if found.

If you know you are using that mode (and with Qt5 there is no other way), I 
strongly recommend to make that obvious by using the NO_MODULE keyword:

find_package(Qt5Core NO_MODULE)

so you see by looking at this line that this is not intended to use a 
FindQt5.cmake file.
Here you'll find more:
http://qt-project.org/doc/qt-5.0/qtdoc/cmake-manual.html
http://www.kdab.com/using-cmake-with-qt-5/

Which parts of KF5 do you want to use ?
You can use FindKF5.cmake from extra-cmake-modules (which has not seen an 
official release yet):
find_package(KF5 MODULE COMPONENTS CMake Compiler InstallDirs
                                   KArchive ItemModels ... )
which gives you more or less everything as with kdelibs 4 (cmake settings, 
compiler settings, install dir variables, etc.)
or each of the KF5 libraries which are already in tier12/ or tier2/ also 
install Config.cmake files, so you can also simply do
find_package(KArchive NO_MODULE)
and it should work too.
But in this case you don't get the KDE-recommended build settings, i.e. you 
will have to care about RPATH settings, install dirs, etc. yourself.

Alex



More information about the Kde-frameworks-devel mailing list