PDA

View Full Version : qmake LIBS missing quotes



redoctober0
5th November 2009, 21:17
Hi,

here's my problem. I work in Windows 7 with VS2008. I need to include a 3rd party library to my qt4 project. The path to the library contains spaces so i have to enclose the full path in quotes. Usually the following line in .pro file would do the job:

LIBS += $$quote(c:\\path to the lib\mylib.lib)

However, i want to use an environment variable to specify the path. And if i change the above line to:

LIBS += $$quote($(MY_VAR)\mylib.lib)

in hope of seeing "$(MY_VAR)\mylib.lib" in the project settings, but instead i see just $(MY_VAR)\mylib.lib (without quotes) which, naturally, messes up the linker.

Does anyone know how i can force the quotes around my lib path?

Thanks.

Sanuden
12th January 2011, 16:05
I ran into the same issue today while trying to use environment variables in a LIBS definition and I found the following link http://bugreports.qt.nokia.com/browse/QTBUG-16531, which indicated a simple workaround. The key is to the instant resolution syntax $$() to resolve the environment variable. So, while


LIBRARIESBASE = %USERPROFILE%\local
LIBS += -L$$quote($$LIBRARIESBASE\lib) -lmylib

does not resolve with quotes if %USERPROFILE% contains spaces,


LIBRARIESBASE = $$(USERPROFILE)\local
LIBS += -L$$quote($$LIBRARIESBASE\lib) -lmylib

works just fine.

I hope this is able to help someone else out.