Manually configuring shadow build in qmake

Sambatyon picture Sambatyon · Mar 2, 2011 · Viewed 9.2k times · Source

There is a feature I really like in qt creator and it is the Shadow build. When the Shadow Build is on, all the generated files (*.moc, Makefile, *.o) will be generated in a given source directory, so the sources directory is kept clean. I am moving from qt creator to kdevelop and I am trying to figure out how this feature works, so far I can create the resulting binary, the moc files and object files to the extra directory using the variables DESTDIR, OBJECTS_DIR and MOC_DIR but I cannot create the makefile in this diretory. Any ideas?

Answer

Steffen picture Steffen · Mar 6, 2011

AFAIK what QtCreator does, basically boils down to this:

 mkdir my_shadow_build
 cd my_shadow_build
 qmake ../my_src_dir

this creates the Makefile itself in the build directory and simply running

 make

there creates all temporary files under the build directory, using the sources from the original directory. This does not require any special stuff in the .pro file but just depends on the usage "from the outside".