[Interest] How to rebuild a Qt project which linked with a static library?

Lincoln Ramsay a1291762 at gmail.com
Wed Jan 23 06:53:47 CET 2013


On 23/01/13 13:29, Vincent Cai wrote:
>          I have a Qt project which is linked with a static library.
>
>          When I updated the static library, and try build the project, 
> the project can't detect that the library is updated and need to rebuild.
>

qmake does not write out dependencies between the target and anything it 
links to.

This is most noticeable with static libraries but it can also be a 
problem with shared libraries.

I imagine qmake doesn't do this because of how difficult it is to know 
exactly which libs the linker will use when linking.

The easiest solution is to force the linker to run again.

If you know (or can find out) the proper paths to your target and libs, 
you can create explicit rules for your Makefile.

I've used something like this in the past.

defineTest(forcedep) {
     eval($${1}.depends = $$2)
     QMAKE_EXTRA_TARGETS += $$1
     export($${1}.depends)
     export(QMAKE_EXTRA_TARGETS)
}
forcedep($$OUT_PWD/$$TARGET, $$PWD/somelib.a)

-- 
Link

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130123/24cba044/attachment.html>


More information about the Interest mailing list