Search code examples
qtdirectoryqmake

Qmake incorrect output directory


When I try to generate a makefile with qmake in a sub-directory, the makefile is generated in a wrong directory.

Here is my QmakeTest.pro, the main.cpp is a simple hello world code :

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

When I run qmake:

qmake -makefile -o build/makefile
qmake -makefile -o build/makefile

The first time, the folder build/ is created and the makefile is created in the right directory, the second time(and each time if build/ already exist), the makefile is generated in the folder build/build/ (a subfolder build inside the first one).

Why does qmake create a second subdirectory if the subdirectory build/ already exist ?

For info: qmake --version

QMake version 3.0
Using Qt version 5.3.0 in /usr/lib/x86_64-linux-gnu

Edit: The bug seems to be fixed with the QMake provided with qt 5.4.0


Solution

  • You can use

     QMAKE_MAKEFILE += build/makefile
    

    in your project file to create the makefile