Issue Building Subdirs Project
-
I have a subdirs project with the following structure
main |__main.pro |__app | |__app.pro | |__Qxls | |__qxls.pri |__mylib | |__mylib.pro |__mytest |__mytest.pro
Everything compiles and runs fine. My issue is if I change some class in the app and compile (ctrl-b) it picks up the changes no problem. However, if I change a class in mylib or mytest ctrl-b does not pick up the changes, I have to do a rebuild which takes a few minutes and is a big waste of time. I reference Qxls from both the mylib and mytest sub projects and I suspect this is the issue, but that's just a guess. What change should I make or how do I resturcture the project to make a simple compile work for the sub projects. If you need to .pro and .pri files I can attach
-
Hi and welcome to devnet,
Static or dynamic libraries ?
-
In that case, you need to use PRE_TARGETDEPS.
-
I have a subdirs project with the following structure
main |__main.pro |__app | |__app.pro | |__Qxls | |__qxls.pri |__mylib | |__mylib.pro |__mytest |__mytest.pro
Everything compiles and runs fine. My issue is if I change some class in the app and compile (ctrl-b) it picks up the changes no problem. However, if I change a class in mylib or mytest ctrl-b does not pick up the changes, I have to do a rebuild which takes a few minutes and is a big waste of time. I reference Qxls from both the mylib and mytest sub projects and I suspect this is the issue, but that's just a guess. What change should I make or how do I resturcture the project to make a simple compile work for the sub projects. If you need to .pro and .pri files I can attach
@agconnell can you show the main pro file, that manages your project?
-
To close the loop on this, I changed the layout of the project and added PRE_TARGETDEPS as noted below. It works as expected now. Thanks!
main |__main.pro |__app | |__app.pro |__mylib | |__mylib.pro |__mytest | |__mytest.pro |__Qxls |__qxls.pro
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../QXlsx/release/libQXlsx.a else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../QXlsx/debug/libQXlsx.a else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../QXlsx/release/QXlsx.lib else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../QXlsx/debug/QXlsx.lib else:unix: PRE_TARGETDEPS += $$OUT_PWD/../QXlsx/libQXlsx.a