I am using qmake to build a project that consists of two applications (say A and B). In order to keep the structure clear, I divided the project in components using a subdirs template for the top level .pro file. Those components can be partitioned in three groups:
1) those that will be used by application A only,
2) those that will be used by application B only,
3) those that will be used by both.
I would like to build all components in group 3 as static libraries, then combine them in a large shared library that applications A and B would link to. I have not found anywhere how to achieve that with qmake. If I try something along the lines of
where Component_1_built_as_static_lib, ..., Component_n_built_as_static_lib are the static libraries corresponding to the components in group 3, I do get a shared library but it is empty; linking applications A and B obviously fails with unresolved symbols.Qt Code:
TEMPLATE = lib CONFIG += shared LIBS += \ -lComponent_1_built_as_static_lib \ -lComponent_2_built_as_static_lib \ ... -lComponent_n_built_as_static_libTo copy to clipboard, switch view to plain text mode
My guess is that the linker only picks what it needs from Component_1_built_as_static_lib, ..., Component_n_built_as_static_lib when building the shared library, but that library does not contain source files itself. Therefore I end up with nothing. How can I force qmake to act dumb and pick everything instead?
For the record, I use Qt 4.6.3 with gcc 4.4.5 and Linux 2.6.32.
Best regards, Olivier.
Bookmarks