Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt does not create output files in debug/release folders in Linux

Tags:

linux

ubuntu

qt

When I build Qt applications on Ubuntu it puts the output files in the main solution folder as opposed to release/debug folders as it does on Windows.

This is problematic because sometimes the output files need to be run as part of the build process (for example to run unit tests).

I have an idea this has something to do with the qmake.conf files but I'm unsure what to do about it.

So my questions are:

  1. Why does this difference exist (could it just be me?)
  2. How should I go about making sure my applications will build correctly on both Windows and Ubuntu?
like image 955
CiscoIPPhone Avatar asked Aug 19 '09 10:08

CiscoIPPhone


2 Answers

The CONFIG variable has debug_and_release and debug_and_release_target set on windows, but not on linux. So the following line will make sure that your build will be the same on linux and windows:

CONFIG *= debug_and_release debug_and_release_target

The documentation shortly mentions it. The file /usr/share/qt4/mkspecs/win32-g++/qmake.conf adds it to CONFIG.

like image 103
bcmpinc Avatar answered Sep 27 '22 17:09

bcmpinc


I assume you're using qmake to do the actual building. You can edit the project files to put the output in different directories like this:

# only for unix:
unix {
    # in debug mode...
    CONFIG(debug, debug|release) {
        DESTDIR = debug
    }
    else {
        DESTDIR = release
    }
}

Obviously in order for this to work you need to be building both debug and release executables. More information on this topic can be found here

Cheers

like image 24
Thomi Avatar answered Sep 27 '22 17:09

Thomi