Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify different Debug/Release output directories in QMake .pro file

Tags:

qt

qmake

I have a Qt project and I would like to output compilation files outside the source tree.

I currently have the following directory structure:

/ |_/build |_/mylib   |_/include   |_/src   |_/resources 

Depending on the configuration (debug/release), I will like to output the resulting files inside the build directory under build/debug or build/release directories.

How can I do that using a .pro file?

like image 226
Etienne Savard Avatar asked Apr 05 '10 20:04

Etienne Savard


People also ask

How do I change the build directory in Qt?

Also recently, newer versions of Qt have another little button on the right hand side of the "build directory" input field. It is has like a blue arrow on mine. Click it and you can view all the global build variables.

How do I debug qmake?

You can debug the generated qmake.exe in Qt creator. Click the menu Debug/Start Debugging/Start and Debug External Application, you'll be presented with a dialog, where you can specify the program to debug(c:\qtbuild\qtbase\bin\qmake.exe), its command line arguments(c:\Qt5. 12.1\5.12.


1 Answers

For my Qt project, I use this scheme in *.pro file:

HEADERS += src/dialogs.h SOURCES += src/main.cpp \            src/dialogs.cpp  Release:DESTDIR = release Release:OBJECTS_DIR = release/.obj Release:MOC_DIR = release/.moc Release:RCC_DIR = release/.rcc Release:UI_DIR = release/.ui  Debug:DESTDIR = debug Debug:OBJECTS_DIR = debug/.obj Debug:MOC_DIR = debug/.moc Debug:RCC_DIR = debug/.rcc Debug:UI_DIR = debug/.ui 

It`s simple, but nice! :)

like image 62
mosg Avatar answered Sep 21 '22 21:09

mosg