PDA

View Full Version : Configuring qmake to put files inside proper folder



Momergil
10th May 2014, 16:55
Hello!

For better organization, I'ld like to put all files generated by QtCreator in a build command inside a "build" folder in my projects' folder. I've learned how to do most of this part - by configuring the .pro file of a project with the lines



MOC_DIR = build/moc
OBJECTS_DIR = build/obj
UI_DIR = build/ui
RCC_DIR = build/


and this part runs OK. The problem is that no matter how I try, when I run qmake it still insists in creating a "debug" and a "release" folder in my projects' base folder instead of creating them inside the "build" folder. I tried to correct this by configuring the DESTDIR variable:



win32
{
debug: DESTDIR = build/debug
release: DESTDIR = build/release
}


and although this was enough to make QtCreator put the executables and related in the correct place, qmake still insists in creating a "debug" and "release" folder in my projects' base folder (now always empty). How do I change this? It's interesting that, when configuring the project at the time of creating, I wrote that I wanted de build and release directories to be inside a "build" folder, but still Qt Creator didn't obey me :(


So how do I stop qmake from creating this two unecessary folders in my projects' base directory?


Thanks,

Momergil

anda_skoa
10th May 2014, 18:32
The easiest way to create a build folder is to run qmake from there.
I usually have build at the same level as the project folder itself, i.e. outside the version controlled source folder

Something like


projectfolder
build
install
source

and I would initialize the build like this


cd build
qmake ../source/project.pro PREFIX=../install


Cheers,
_

Momergil
10th May 2014, 19:04
This means you use the Qt command prompt to compile the project? o.O

anda_skoa
11th May 2014, 13:02
No, just to create initialize the build directory.

When configuring the project in QtCreator I point it to that build so it can use it as well.

Cheers,
_