Search code examples
c++qtc++11qt5qmake

qmake Language, how to get current folder name?


The question:

How to read file content into a qmake variable and pass it to the compiler?

Address the issue of reading a text file via qmake.

Instead of reading a text file, I would like to get current folder (the folder where this file is in) name. How do I do that?


Solution

  • Does $$PWD do what you want?

    From the documentation:

    The PWD variable specifies the full path leading to the directory containing the current file being parsed. This can be useful to refer to files within the source tree when writing project files to support shadow builds.