Results 1 to 3 of 3

Thread: Adding library dependencies to qmake

  1. #1
    Join Date
    Mar 2008
    Location
    Colorado, USA
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Adding library dependencies to qmake

    I am trying to add a library dependency to my .pro file, so that it will compile the library when necessary.

    For instance, in my source/qtshared library, I successfully created a .pro file with the 'lib' TEMPLATE. This creates a static library called libqtshared.a.

    I have another directory called source/qtcomms, in which I create a .pro file with the 'app' TEMPLATE. This includes the library ../qtshared/libqtshared.a

    When libqtshared.a actually exists, I have no problems compiling my app in the qtcomms area. However, when this library does not exist, I want my make to be smart enough to know to compile libqtshared.a based on the makefile (generated by qmake).

    In my qtshared.pro the important variables are:
    TEMPLATE = lib.
    CONFIG += staticlib create_prl #(not sure if the 2nd variable is necessary)

    In my qtcomms.pro the important variables are:
    TEMPLATE = app
    DEPENDPATH += ../qtshared
    INCLUDES += . ../qtshared
    LIBS += -L../qtshared -lqtshared
    CONFIG += link_prl #(not sure if this is needed or not)

    I know I can also do a top level .pro file in my source area with the 'subdirs' TEMPLATE, but I would rather have a sufficient makefile actually within my qtcomms area so I can compile it individually.

    Any help is greatly appreciated. Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Adding library dependencies to qmake

    Try using the TARGETDEPS variable. TARGETDEPS += ../qtshared/libqtshared.a should work.

  3. #3
    Join Date
    Mar 2008
    Location
    Colorado, USA
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding library dependencies to qmake

    Quote Originally Posted by wysota View Post
    Try using the TARGETDEPS variable. TARGETDEPS += ../qtshared/libqtshared.a should work.
    You would think that would work, but no luck. I get "No rule to make target ../qtshared/libqtshared.a". Maybe there is something else I need to do as well?

Similar Threads

  1. Replies: 7
    Last Post: 22nd December 2010, 08:13
  2. Replies: 4
    Last Post: 7th April 2010, 23:09
  3. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  5. Win32 qmake: building a static library
    By Amanda in forum Qt Programming
    Replies: 5
    Last Post: 8th November 2006, 19:32

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.