Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what do $$PWD and . mean in .pro in qt

Tags:

qt

qmake

I came across a lib missing problem in my app, it turns out that this might relate to my understanding of $$PWD and . in .pro file of qt project.

  1. So do $$PWD and . both mean the dir, which contains the .pro file OR the dir, which is generated by building process(like: ****-build-desktop-Qt_4_8_1_in_PATH__System__Debug). Or, they mean different things.

  2. in some variable declaration like OBJECTS_DIR = obj/Obj, it looks like that . means the generated dir. Whereas, in HEADERS += remoteclient.h ./RealPlay/realplay.h \, it looks like that . means the dir that contains .pro file.

  3. How about their meanings in LIBS and DESTDIR, etc. ?

like image 253
Henry Avatar asked Mar 01 '16 19:03

Henry


1 Answers

$$PWD means the dir where the current file (.pro or .pri) is.

It means the same in LIBS. I just used it like this in my project:

LIBS += -L$$PWD/deps/android -lopenal

. doesn't have any special meaning in the .pro file. It means the same thing as in Linux/Unix shell: the current working directory. If you use it in LIBS, it will most probably refer to the build directory where the link command is being run. . is not expanded. If you say -L. the linker will literally get -L.

In the case of HEADERS += remoteclient.h ./RealPlay/realplay.h \ qmake will treat these paths relative to $$PWD so it doesn't matter if there's . or not. HEADERS += $$PWD/remoteclient.h $$PWD/./RealPlay/realplay.h \ would be the effective search paths in this case. Otherwise out-of-source builds wouldn't work.

Note that . in the middle of a path doesn't do anything.

like image 105
juzzlin Avatar answered Oct 05 '22 17:10

juzzlin