Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Compile library and link active project when library code changes
Forum Updated to NodeBB v4.3 + New Features

Compile library and link active project when library code changes

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 258 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nando
    wrote on last edited by Nando
    #1

    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...

    Nando

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      You can use a subdir setup
      https://wiki.qt.io/SUBDIRS_-_handling_dependencies

      Stay healthy too! :)

      N 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        You can use a subdir setup
        https://wiki.qt.io/SUBDIRS_-_handling_dependencies

        Stay healthy too! :)

        N Offline
        N Offline
        Nando
        wrote on last edited by Nando
        #3

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

        My folder structure is as following:

        application/
        application/application.pro
        application/src/lib/lib.pro
        application/src/main-application/main-application.pro

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

        TEMPLATE = subdirs
         
        SUBDIRS = \          
                lib \
                main-application
        
        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?

        I 1 Reply Last reply
        0
        • N Nando

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

          My folder structure is as following:

          application/
          application/application.pro
          application/src/lib/lib.pro
          application/src/main-application/main-application.pro

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

          TEMPLATE = subdirs
           
          SUBDIRS = \          
                  lib \
                  main-application
          
          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?

          I Offline
          I Offline
          Infinity
          wrote on last edited by
          #4

          @Nando You have to put:

          PRE_TARGETDEPS += \
             $$PWD/../src/lib/libyourlib.a
          

          in your apllication/application.pro file.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved