Search code examples
qtconfigurationbuild-processqmake

How do I specifiy an object directory in a Qt project file?


I am building a console Qt project.

Currently, my project file looks like this:

CONFIG += qt console debug 
CONFIG -= app_bundle

HEADERS = HelperClass.h
SOURCES = HelperClass.cpp \
            main.cpp
TARGET = doit

My QMAKESPEC environment variable is set to: macx-g++

I go to the directory with the project (and source) files and run qmake (which builds a Makefile) then make to build the project. The object files (*.o) from the compilation are placed in the same directory with my source and the executable.

How do I configure this build to place those object files in a sub directory so they don't pollute my source area?


Solution

  • set OBJECTS_DIR:

    OBJECTS_DIR = ../myproject/tmp
    

    See http://doc.qtsoftware.com/4.5/qmake-variable-reference.html#objects-dir