What to do $$ PWD and. means in .pro in qt

I ran into the problem of the lack of lib in my application, it turned out that this could be due to my understanding of $$PWD and . in the .pro qt project file.

  • So, $$PWD and . mean the directory containing the .pro OR file that is generated by the build process (for example: * *** - build-up desktop Qt_4_8_1_in_PATH__System__Debug) . Or they mean different things.

  • in some variable declaration like OBJECTS_DIR = obj/Obj , it looks like . means generated directory . Whereas in HEADERS += remoteclient.h ./RealPlay/realplay.h \ it looks like this:. means the directory containing the .pro file .

  • What about their values ​​in LIBS and DESTDIR etc.?

+7
qt qmake
source share
1 answer

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

This means the same in LIBS . I just used it in my project:

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

. doesn't really matter in the .pro file. This means the same as in the Linux / Unix shell: the current working directory. If you use it in LIBS , most likely it will refer to the assembly directory in which the link command is run. . not expanding. If you say -L. , the linker will literally get -L.

In the case of HEADERS += remoteclient.h ./RealPlay/realplay.h \ qmake will consider these paths relative to $$PWD , so it doesn't matter if it exists . or not. HEADERS += $$PWD/remoteclient.h $$PWD/./RealPlay/realplay.h \ would be an effective way to search in this case. Otherwise, assembly outside the source will not work.

Please note that . in the middle of the way does nothing.

+7
source share

All Articles