Results 1 to 2 of 2

Thread: I finally figured out how to do library dependencies.

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

    Default I finally figured out how to do library dependencies.

    I had posted a couple of questions on how to have an application in one directory, qttest, depend upon a static library in another directory, qtshared. I wanted it so that whenever any source code changes in qtshared, whenever I build qttest, it would be smart enough to rebuild qtshared and relink qttest against it.

    First of all, I used a .pro file in an upper level directory (the dir right above qttest and qtshared) so that it would build qtshared and qttest.
    This is my .pro file in the upper dir:
    ################################################## ##
    TEMPLATE = subdirs
    SUBDIRS = qt_shared qt_test
    qt_shared.file = qtshared/qtshared.pro
    qt_test.file = qttest/qttest.pro
    qt_test.target = QtTest
    ################################################## ##
    However, this still wasn't good enough, because whenever I changed qtshared, it would recompile qtshared but not qttest.

    However, in the .pro file in the subdir qttest, I added the line:
    PRE_TARGETDEPS += ../qtshared/libqtshared.a.

    By doing this, even if I only try to make QtTest in the upper level directory, it is smart enough to go to qtshared, make that static library, then go to qttest and make that application.


    Sorry if this is obvious or old news, just in my short time on the forum it seemed people were trying to figure out how to do this. I hope this helps someone.

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

    Default Re: I finally figured out how to do library dependencies.

    One other thing. If I want to build individual targets, like QtTest, I should add:
    qt_test.depends = qt_shared

    Otherwise I have to build everything.

Similar Threads

  1. Adding library dependencies to qmake
    By sadastronaut in forum Installation and Deployment
    Replies: 2
    Last Post: 18th March 2008, 17:06

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.