1

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)
4
  • 1
    Did you check a Shadow build checkbox on the Project tab in Qt Creator? Commented Mar 14, 2016 at 23:27
  • No I didn't. Should I check it? Commented Mar 14, 2016 at 23:46
  • Looks like I did shadow build before. I will do some research about what shadow build actually is. Thanks. @EvgenyS. please submit as an answer, I will mark it as correct answer. Commented Mar 14, 2016 at 23:49
  • Qt5.8 still does. With Shadow build checked, having a hierarchy of Qt projects, in build-future-Desktop_Qt_5_8_0_MSVC2015_64bit-Debug folder, for each projects it does create debug and release folders (although in this care release ones will always be empty). Dependent libs are not found. [SO]: Qt Creator creates both a debug and a release folder inside the designated debug folder offers some workarounds, but the problem is still there. Commented Jun 8, 2017 at 12:53

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

This issue has been around for seven years :(

After my research on the qmake process, the reason why the debug and release folders are still generated is that the ***_DIR is not completely specified. After specifying PRECOMPILED_DIR in my project, these two directories will no longer be generated.

Base on the source, if any variables are not set and debug_and_release is included in CONFIG, then empty or . is replaced with debug/ or release/, and then the corresponding directory is generated. So if you are not sure, then you can specify all directory variables listed below:

OBJECTS_DIR
MOC_DIR
RCC_DIR
PRECOMPILED_DIR
QGLTF_DIR
TRACEGEN_DIR
QMLCACHE_DIR
LRELEASE_DIR
LEX_DIR
YACC_DIR

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.