Results 1 to 2 of 2

Thread: Conditional linkage

  1. #1
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Conditional linkage

    I have two sets of static libraries: one is for production release and another for debugging purposes.

    I can conditionally compile with headers from both libraries using #ifdef but how can I conditionally link?

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Conditional linkage

    You'll have to put those settings into your makefile or qmake project.

    Qt Code:
    1. production {
    2. DEFINES += PRODUCTION
    3. LIBS += -lproductionlib
    4. }
    5. else:release {
    6. DEFINES += RELEASE
    7. LIBS += -lreleaselib
    8. }
    To copy to clipboard, switch view to plain text mode 

    then when you call
    Qt Code:
    1. qmake -config production
    To copy to clipboard, switch view to plain text mode 
    your code will be linked against the productionlib library and with
    Qt Code:
    1. qmake -config release
    To copy to clipboard, switch view to plain text mode 
    it will be linked against the releaselib library.

    Of course you can do more or less the same using the automake tools and probably also with CMake.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. The following user says thank you to franz for this useful post:

    TorAn (24th December 2009)

Similar Threads

  1. QListView with conditional vertical automatic scroll
    By jmesquita in forum Qt Programming
    Replies: 2
    Last Post: 1st August 2009, 03: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.