Qt World Summit: Register Today!

Compile library and link active project when library code changes

  • Hi,

    i have 2 qmake projects. One is the main application and one is a library.

    Now i want to get the library recompiled AND relinked with my main application when a file inside the library has changed.

    Somehow i always need to manually build the lib, then pseudo change a file in my main application (to trigger new linkage) to get the changes take effect.

    There must be a way to define the dependency between my main application and my lib, but how?

    Thank's for your help, and stay healthy...


  • Lifetime Qt Champion

    You can use a subdir setup

    Stay healthy too! :)

  • @mrjj Thank you.
    I now tried it with SUBDIR like in the link.

    My folder structure is as following:


    And in the application.pro i set it up with SUBDIRS and .depends like this:

    TEMPLATE = subdirs
    SUBDIRS = \          
            lib \
    lib.subdir     = src/lib
    main-application.subdir = src/main-application
    main-application.depends = lib

    Everything compiles fine.

    But now the problem remains.
    If i only change somethin inside lib and then rebuild only the lib get rebuild.
    I want that after rebuilding the lib the main-application also gets linked against the new lib... Any ideas how to solve this?

  • @Nando You have to put:


    in your apllication/application.pro file.

Log in to reply