Results 1 to 2 of 2

Thread: qmake LIBS missing quotes

  1. #1
    Join Date
    Sep 2008
    Posts
    11
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default 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.

  2. #2
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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
    Qt Code:
    1. LIBRARIESBASE = %USERPROFILE%\local
    2. LIBS += -L$$quote($$LIBRARIESBASE\lib) -lmylib
    To copy to clipboard, switch view to plain text mode 
    does not resolve with quotes if %USERPROFILE% contains spaces,
    Qt Code:
    1. LIBRARIESBASE = $$(USERPROFILE)\local
    2. LIBS += -L$$quote($$LIBRARIESBASE\lib) -lmylib
    To copy to clipboard, switch view to plain text mode 
    works just fine.

    I hope this is able to help someone else out.

Similar Threads

  1. qmake: removing --no-undefined option for libs.
    By davemar in forum Qt Programming
    Replies: 2
    Last Post: 14th October 2009, 10:08
  2. qmake sux a lot
    By singermornings in forum Qt Programming
    Replies: 6
    Last Post: 29th January 2009, 09:33
  3. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 06:57
  4. qmake, conditioning & bundled libs
    By sebr in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2006, 10:38
  5. Using qmake to build multiple apps and libs
    By marchand in forum Newbie
    Replies: 2
    Last Post: 12th June 2006, 18:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.