Search code examples
qtqmake

Qt after specifying output directory it still create debug and release folders in local directory


I use macro to specify the output directory in .pro file which works fine. but my local directory still have debug and release folders created. How could I stop creating those 2 empty folders?

EDIT: this is on my Windows 7. I use qt 5.5 creator 3.6.0. same setup on Windows 10 behaves differently. On Windows 10 it output to folder at the same level as bin, called build-configuration-details.

debug {
    DESTDIR = ../../bin/debug
    MOC_DIR = ../../build/lib/debug
    OBJECTS_DIR = ../../build/lib/debug
}
release {
    DESTDIR = ../../bin/release
    MOC_DIR = ../../build/lib/release
    OBJECTS_DIR = ../../build/lib/release
}

original structure

app
  |
  lib
   |
   .pro

after compile

bin
| |
  debug (libs)
| |
  release (libs)
|
build
| |
  debug (objects)
| |
  release (objects)
|
app
  |
  lib
   |
   .pro
   |
   debug (empty)
   |
   release (empty)

Solution

  • To avoid creating extra debug and release folders in source tree you should enable Shadow build in Qt Creator.

    When it is not enabled the Qt Creator creates debug and release folders in the source tree (more precisely saying qmake creates them). What you set in .pro files only says to qmake where you want to put some specific folders. But the qmake itself is running in your source tree and creates there debug and release folders. When you enable shadow build then qmake runs in the folder that you set in shadow build path.