Details
-
Sub-task
-
Resolution: Done
-
P2: Important
-
None
-
None
-
573006f3
Description
For adding the corresponding "LIBS += -Lfoodir -lfoo",
and (for static libs?) the option to generate the corresponding "PRE_TARGETDEPS" entry as well (for relinking the project whenever the library changes).
It can be a dialog too (instead of wizard).
The goal is to nicely handle the case of linking against the shared libraries. If we don't use PRE_TARGETDEPS than whenever we change dependent library the target is not relinked. PRE_TARGETDEPS makes the trick (according to con: hjk found it).
The dialog should have 2 fields:
1) full path to the selected library (filename included)
2) additional path to includes
The dialog would append the following snippet into pro file:
LIBS += -L$$OUT_PWD/realtive_path_to_library -l_library_name_
INCLUDEPATH += $$PWD/realtive_path_to_includes
The dialog would also recognize if the library is static or dynamic (e.g. on linux: the library is considered to be dynamic if the extension is .so and static if the extension is .a). In case this is static we would add in addition:
unix: PRE_TARGETDEPS += $$OUT_PWD/realtive_path_to_library/library_name
win32: ...
We should also generate DEPENDPATH += $$PWD/realtive_path_to_includes (the same as INCLUDEPATH) for both static and dynamic cases - this ensures whenever dependent header changes the target is recompiled. (If we have only PRE_TARGETDEPS in case of static lib the target will only be relinked, but should be recompiled too)
Note that we still might want to generate LIBS += -L$$PWD/... and PRE_TARGETDEPS += $$PWD/... if the dependent library is not a part of the build process (e.g. it's built outside of the build tree and is copied manually into libs).
Mac: In case of no-framework build of the library, everything is the same as for unix, except that dynamic library should be recognized by .dylib extension. In case of framework build of the library the generated LIBS should look like:
LIBS += -F$$OUT_PWD/realtive_path_to_framework -framework framework_name
Should we have different selector for frameworks and for libraries? (in one we select a library file while in the other one we select a framework dir).
Note: building static lib as a framework doesn't make sense