[Qt-interest] call qmake from within c++

Clinton Stimpson clinton at elemtech.com
Fri Mar 20 22:24:50 CET 2009


Kurtis Nusbaum wrote:
> I'm currently making a program that writes source code. I've 
> extensively used Qt in the source code that my program writes. I was 
> wondering if I might be able to get my program to run qmake so that my 
> program can compile the source code that it generates. Is there away 
> to do this directly in my source code? Or do I just have to develop a 
> different solution for all platforms involving their command lines?
>
> -Kurtis

CTest (www.cmake.org) already does that work for you.
"ctest --help" gives you the command line args to build code from the 
command line with make/nmake/Xcode/Visual Studio/etc... going on under 
the covers.

I haven't tried, but maybe you could link the CTest library into your 
code, and call the library directly.
You could still use it with qmake instead of cmake, as cmake is not 
required, but cmake generated files picked up by ctest would make it 
easier so you don't have to specify as many parameters.
You should also be able to get back warnings and errors already parsed, 
if you needed that.

Clint




More information about the Qt-interest-old mailing list