QTCreator .pro file: Setting LIBS path depending on DEBUG / RELEASE

守給你的承諾、 提交于 2019-12-10 11:57:08

问题


As a newbie to Qt I am writing a small project depending on another project, located in a parallel directory.

In my .pro file some .obj files are includes as below (which works). However, when creating a release I'd like to use the other project's release and not its debug path. I have checked the Qt variables and found the "TARGET example". But I failed to apply it to my LIBS, especially since the build can be for both debug_and_release , and I have no idea how to write the LIBS path then.

Pro file:

LIBS += -L"../../OtherApp/OtherApp-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2010__Qt_SDK__Debug/debug"
LIBS += http.obj some other obj files

"Target example":

 build_pass:CONFIG(debug, debug|release) {
 unix: TARGET = $$join(TARGET,,,_debug)
 else: TARGET = $$join(TARGET,,,d)
 }

Can I write LIBS += -L"......."$$(TARGET)"......" , especially if target may contain both debug and release?

[Edit 1] I have found a solution: https://stackoverflow.com/a/11612903/356726


回答1:


By using the wizard (inlucde internal library) I got the following "code" created. This is most likely the solution:

win32:CONFIG(release, debug|release): LIBS += -LLIBS += -L"../../MyApp/current/MyApp-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2010__Qt_SDK__Release/release"
else:win32:CONFIG(debug, debug|release): LIBS += -L"../../MyApp/current/MyApp-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2010__Qt_SDK__Debug/debug"


来源:https://stackoverflow.com/questions/11611399/qtcreator-pro-file-setting-libs-path-depending-on-debug-release

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!