Monday, October 5, 2009

Project Not Linked When Dependent Library Changes - Update

PRE_TARGETDEPS fixes this linking issue. You need to add something similar to the following to your .pro file that uses a static library:

PRE_TARGETDEPS += ../path/to/your/lib.a

This will ensure that if your lib changes (but not the project using it), everything will be correctly relinked.

Bit of a hack, but this is not unusual with qmake. :)


  1. Thanks for the tip :)

  2. Isn't this supposed to work also with the Project's Dependencies option?

    I guess that you are building that lib.a yourself...


  3. I don't go anywhere near the Qt Creator Project settings. Why? Because all these settings are stored in a special .pro.user file that cannot be placed under version control because it contains hard-coded paths! I really dislike the 'session' system and want *all* build rules inside the .pro file instead. That way my team can check out a project and build the whole thing without first messing with Qt Creator's Project settings. This is a hot topic on the Qt Creator mailing list BTW - I am not alone in wishing for better subdirs and dependency support. :)

  4. 100% agreement on the pro.user file issue. The file, the session system, and the entire project window is utterly useless.

    Even if the paths were relative, dependencies should be stored in the project file not a user-specific store. That's for breakpoints etc.

    Unfortunately Nokia a absolutely determined to keep it.

  5. The problem is that currently we need the .pro.user files becasue in Windoz we need to specify which version of MingWin Make should be used while multiple MingWin might be installed (older gcc is still in the official MingW while QT needs gcc4).
    It is really a pain!