Qmake and passing $ORIGIN to linker option -rpath

Vitor Py picture Vitor Py · Sep 21, 2011 · Viewed 8.8k times · Source

I would like to use the -rpath linker option to set the .so search path. I'd like it to search [app_path]/../lib. I've tried add this to my qmake .pro file:

QMAKE_LFLAGS += -Wl,-rpath=$ORIGIN/../lib/

But qmake links my project this way:

g++ -Wl,-rpath=RIGIN/../lib/ -Wl,-O1 -o myoutput main.o [...]

How can I escape the $ORIGIN?

Answer

Vitor Py picture Vitor Py · Sep 22, 2011

I found here a way to properly escape it:

QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN/../mylibs\''