Results 1 to 2 of 2

Thread: qmake project dependencies

  1. #1
    Join Date
    Jun 2008
    Posts
    49
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question qmake project dependencies

    I'm looking at the qmake documentation, but I'm having troulbe seeing how I can make qmake work in the following context.

    I'm having a range of libraries and some executables, all in separate projects. I want each project do mark the other as a dependency, and build it if needed. What would be even better if projects could export some of their properties, like include file paths, to project that depend on them, so that it's sufficient to just specify the project dependency to have everything set to build the project.

    for example, consider the following directory structure:

    Qt Code:
    1. root
    2. |-- app1
    3. |-- app2
    4. |-- lib1
    5. | |-- include (lib1 public include files)
    6. | ...
    7. | `-- lib (lib1 target build directory, containing the built libraries)
    8. `-- lib2
    9. |-- include (lib2 public include files)
    10. ...
    11. `-- lib (lib2 target build directory, containing the built libraries)
    To copy to clipboard, switch view to plain text mode 

    and for the sake of the example, app1 would depend on lib2, which in turn depends on lib1. app2 depends on lib1 alone.

    as far as I got, one has to manually add the following to app1's project files:

    Qt Code:
    1. INCLUDEPATH += ../lib2/include ../lib1/include
    2. LIBS += -L../lib2/lib -llib2 -L../lib1/lib -llib1
    To copy to clipboard, switch view to plain text mode 

    and for app2:

    Qt Code:
    1. INCLUDEPATH += ../lib1/include
    2. LIBS += -L../lib1/lib -llib1
    To copy to clipboard, switch view to plain text mode 

    and for lib2:

    Qt Code:
    1. INCLUDEPATH += ../lib1/include
    2. LIBS += -L../lib1/lib -llib1
    To copy to clipboard, switch view to plain text mode 


    why I'd be looking for a qmake-based solution, that would enable just noting an external library are the following:

    • to have a single point for marking dependencies (vs. marking includepath, libs, etc. all separately, which is prone to human error and a duplication of paths)
    • to propagate dependency tree information (e.g. in the above example, lib2 could propagate the dependency details for lib1 up to app1)
    • makeing full dependency-aware rebuilds (e.g. changes in lib1 could trigger a rebuild in app1, lib2 and app2 as well)


    with a possible qmake-based solution, would could use the following in app1:

    Qt Code:
    1. DEPENDS_ON = ../lib2/lib2.pro
    To copy to clipboard, switch view to plain text mode 

    for lib2:

    Qt Code:
    1. DEPENDS_ON = ../lib1/lib1.pro
    2. EXPORT_INCLUDEPATH += include
    3. EXPORT_LIBS += -llib1
    To copy to clipboard, switch view to plain text mode 

    for lib1:

    Qt Code:
    1. EXPORT_INCLUDEPATH += include
    2. EXPORT_LIBS += -llib2
    To copy to clipboard, switch view to plain text mode 


    maybe this is all there, and I'm just not finding it in the documentation? maybe none if this is there?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: qmake project dependencies

    See Qt Centre wiki: [WIKI]Undocumented qmake[/WIKI] (notice especially paragraph "SUBDIRS projects").
    J-P Nurmi

Similar Threads

  1. Qmake + Xcode + Dependencies?
    By amnesiac in forum Qt Programming
    Replies: 3
    Last Post: 6th June 2008, 13:45
  2. qmake -project does not work
    By Caius Aérobus in forum Installation and Deployment
    Replies: 2
    Last Post: 7th February 2008, 17:55
  3. qmake: add to project but do not compile
    By jesse in forum Newbie
    Replies: 2
    Last Post: 8th November 2007, 16:03
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  5. QMAKE: Specifying Build Dependencies
    By JohnSuykerbuyk in forum Qt Programming
    Replies: 1
    Last Post: 5th May 2006, 09:46

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.