Results 1 to 3 of 3

Thread: Does Qt Creator understand debug/release scopes in .pro files?

  1. #1
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Does Qt Creator understand debug/release scopes in .pro files?

    If in a .pro file, I use the following

    Qt Code:
    1. win32 {
    2. debug {
    3. DESTDIR = ../build_win32/debug
    4. } else {
    5. DESTDIR = ../build_win32/release
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 
    Qt Creator will always look for the executable to run/debug in the ../build_win32/release directory, as if the "debug" scope was never active. The same happens removing the outer "win32 { ... }" condition or swapping the inner conditions and using "release" instead. I have tried "debug", "Debug", "DEBUG", "_DEBUG": none seems to be known to Qt Creator.

    The build process in itself is correct (the executable ends up in the right directory), but launching the executable with F5, Qt Creator always looks for it in the 'else-d' directory and, of course, while attempting to debug, it finds nothing.

    The same is true under Linux (of course replacing or removing the win32 condition!). I'm using Qt Creator 1.2.1 with Qt 4.5.2 32bit under XP SP3 or Ubuntu Jaunty.

    Any suggestion would be appreciated.

    M.

    P.S.: I know that the "Shadow build" option would be a work-around, but I'm attempting to avoid using it as this setting cannot be set independently for each platform.

  2. #2
    Join Date
    Feb 2009
    Posts
    33
    Thanks
    6
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Does Qt Creator understand debug/release scopes in .pro files?

    QtCreator is a bit different than using straight qmake as it defines a "debug_and_release" flag in the CONFIG variable by default. You can query this flag for "debug" or "release" by specifying

    Qt Code:
    1. CONFIG(debug, debug|release) {
    2. #debug code here
    3. }
    To copy to clipboard, switch view to plain text mode 

    or conversely...

    Qt Code:
    1. CONFIG(release, debug|release) {
    2. #release code here
    3. }
    To copy to clipboard, switch view to plain text mode 

    What I do in my own QtCreator projects is convert the "debug_and_release" flag into the separate "debug" and "release" flags by doing this...

    Qt Code:
    1. # ensure one "debug_and_release" in CONFIG, for clarity...
    2. debug_and_release {
    3. CONFIG -= debug_and_release
    4. CONFIG += debug_and_release
    5. }
    6. # ensure one "debug" or "release" in CONFIG so they can be used as
    7. # conditionals instead of writing "CONFIG(debug, debug|release)"...
    8. CONFIG(debug, debug|release) {
    9. CONFIG -= debug release
    10. CONFIG += debug
    11. }
    12. CONFIG(release, debug|release) {
    13. CONFIG -= debug release
    14. CONFIG += release
    15. }
    To copy to clipboard, switch view to plain text mode 

    Hope that helps,
    ~ andy.f

  3. The following 4 users say thank you to andy.fillebrown for this useful post:

    bpoteat (16th December 2009), BrainB0ne (11th January 2012), miwarre (31st August 2009), rahuldas (30th July 2011)

  4. #3
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Does Qt Creator understand debug/release scopes in .pro files?

    Great, it DOES work!!

    Thank you!
    M.

Similar Threads

  1. qmake using source files not in .pro file
    By Asperamanca in forum Newbie
    Replies: 12
    Last Post: 9th July 2009, 15:29
  2. Generating .pro files from vcproj file or CMake file
    By ramazangirgin in forum Qt Programming
    Replies: 2
    Last Post: 17th February 2009, 09:37
  3. Qt .pro files
    By adhit in forum Qt Programming
    Replies: 5
    Last Post: 15th September 2008, 22:51
  4. how to include object files in .pro file
    By babu198649 in forum Newbie
    Replies: 1
    Last Post: 1st July 2008, 08:23
  5. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 21:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.