qmake LIBS missing quotes
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.
Re: qmake LIBS missing quotes
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
Code:
LIBRARIESBASE = %USERPROFILE%\local
LIBS += -L$$quote($$LIBRARIESBASE\lib) -lmylib
does not resolve with quotes if %USERPROFILE% contains spaces,
Code:
LIBRARIESBASE = $$(USERPROFILE)\local
LIBS += -L$$quote($$LIBRARIESBASE\lib) -lmylib
works just fine.
I hope this is able to help someone else out.