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. [SOLVED] How can I add extra configs to a subproject at run time?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How can I add extra configs to a subproject at run time?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k Views 1 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.
  • U Offline
    U Offline
    uranusjr
    wrote on last edited by
    #1

    I have a project that depends on an external lib, structured like this:

    @
    project/
    project.pro
    3rdparty/
    3rdparty.pro
    the_lib_I_depend_on
    src/
    src.pro
    @

    both project.pro and 3rdparty.pro are subdir projects. src.pro is the one that really builds the application.

    The lib is itself a working qmake project, producing a dynamic-linked library, but instead of installing it to the target machine I want to statically linked to it instead.

    I know that I can add CONFIG += staticlib to the lib's .pro file to make it produce a static lib, but I would prefer not to modify the project itself, so that I can include the project as a git submodule directly. But is it possible? How? Adding CONFIG += staticlib in neither project.pro nor 3rdparty.pro works.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Have you tried to add CONFIG+=staticlib to qmake command line?
      If you use QtCreator then you can add this option to a build step in a Projects page.

      1 Reply Last reply
      0
      • U Offline
        U Offline
        uranusjr
        wrote on last edited by
        #3

        Yes it works—thanks for pointing it out.

        Wonders if there's a solution that works if I ever want this not to be global and want this to be applied only to selected subdirs. But this works for my use case.

        1 Reply Last reply
        0
        • U Offline
          U Offline
          uranusjr
          wrote on last edited by
          #4

          I just came up with an another solution with ".qmake.cache and QMAKE_SUBSTITUTES":http://qt-project.org/wiki/QMake-top-level-srcdir-and-builddir . I put file .qmake.cache.in containing CONFIG+=staticlib in my 3rdparty directory, and added an extra rule QMAKE_SUBSTITUTES+=.qmake.cache in 3rdparty.pro. Seems like a a better solution for me since I don't need to remember typing qmake CONFIG+=staticlib anymore.

          And this can probably solve the selected subdir problem I mentioned in the previous comment. You can make a new job that generates qmake.cache.in files at runtime in selected paths, and make 3rdparty.pro depend on it. Haven't try it, but seems like it would work.

          1 Reply Last reply
          0

          • Login

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