Results 1 to 5 of 5

Thread: .pro file syntax

  1. #1
    Join Date
    Jan 2011
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default .pro file syntax

    I have managed to build a Qt app on my Fedora 14 64 bit box, install Qt in wine, and successfully build my app under the wine environment so that I can build the linux as well as the windows version on my 64 bit linux machine. I feel that I have accomplished quite a bit.

    I have one remaining issue which I would appreciate some help resolving.

    I am statically linking to an outside library. When compiling on the windows side, I want to link to the release version when I am making a release version of my app, and I want to link to the debug version of the external library when I am making the debug version of my app.

    In my .pro file I have the following:
    Qt Code:
    1. unix {
    2. unix stuff
    3. }
    4. win32 {
    5. win stuff
    6. }
    To copy to clipboard, switch view to plain text mode 
    In order to select the debug or release version, I have tried the following:
    Qt Code:
    1. win32 {
    2. CONFIG(release debug|release) {LIBS += path\to\release\library.a}
    3. CONFIG(debug debug|release) {LIBS += path\to\debug\libraryd.a}
    4. }
    To copy to clipboard, switch view to plain text mode 
    As well as:
    Qt Code:
    1. win32 {
    2. release {LIBS += path\to\release\library.a}
    3. debug {LIBS += path\to\debug\libraryd.a}
    4. }
    To copy to clipboard, switch view to plain text mode 
    Neither one of these throws any errors when compiling, but neither one of them produces the desired result, as the linker uses the same library either way.

    What is the correct syntax to accomplish what I am trying to do?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: .pro file syntax

    Try using the "build_pass", something like this:
    Qt Code:
    1. build_pass:CONFIG(debug, debug|release) {
    2. LIBS += debug libs
    3. } else {
    4. LIBS += release libs
    5. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2011
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: .pro file syntax

    Works like a champ! Thank you very much.

  4. #4
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: .pro file syntax

    While the 'buildpass' hint is correct, I believe the real problem was the missing comma in CONFIG(release,debug|release)

  5. #5
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: .pro file syntax

    Not directly related to what you asked... but you can cros compile directly from Fedora into win32. See this post (about Fedora 11, but will still apply to your case):
    http://lukast.mediablog.sk/log/?p=155

Similar Threads

  1. Syntax confusion
    By baluk in forum Newbie
    Replies: 3
    Last Post: 11th December 2010, 16:58
  2. Regarding syntax
    By Yayati.Ekbote in forum Qt Programming
    Replies: 3
    Last Post: 27th January 2010, 15:15
  3. Need help getting QAbstractItemView syntax correct
    By Hookem in forum Qt Programming
    Replies: 3
    Last Post: 4th December 2008, 10:34
  4. Odd Syntax
    By acxdotfm in forum Qt Programming
    Replies: 2
    Last Post: 24th October 2008, 21:23
  5. Refreshing syntax highlighting
    By jpn in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2006, 21:09

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.