PDA

View Full Version : Qt pro files and CMAKE library projects



matsukan
22nd August 2016, 13:57
It's possible to add cmake based project to .pro a.k.a qmake build process ? I would like build need CMake projects together with qmake based project using subdir template.

anda_skoa
22nd August 2016, 15:10
Hmm, you might need some dummy source file to satisfy the requirements of the lib target inside your custom .pro file for the sub project and a custom target that actually runs the build.

The cmake step is probably just a call with QMake's system() inside the .pro file for the sub directory.

Though it might be worthwhile to consider switching to cmake for the overall project.

Cheers,
_

d_stranz
24th August 2016, 04:59
There is Qt documentation on using CMake with Qt (http://doc.qt.io/qt-5/cmake-manual.html). There is similar documentation (https://www.kdab.com/using-cmake-with-qt-5/) on the KDAB web site.

There is an (abandoned) SourceForge project (https://sourceforge.net/projects/qmake2cmake/) which supposedly generates CMakelists.txt files from .pro files, but as the comments there imply, it may not work well for complex Qt projects.

It would be better from a maintainability point of view to just pick one build system or the other and port your projects to use that one exclusively. Otherwise, I think anda_skoa's suggestion to run cmake from QMake (or the corresponding cmake version to run an external QMake process) is the only way to have a mixed build system.

A mixed build system would probably give you headaches trying to track down why (and where) builds fail, because the two build systems probably won't communicate problems to each other very well.