Hello, I'm thinking about what would be the best way for including othe dependency .pri's from my .pro / .pri files.

At the moment I have the following (in my project.pro file):
Qt Code:
  1. !include($$PWD/../dir1/dependency1.pri) {
  2. message("project.pro: can't find $$PWD/../dir1/dependency1.pri")
  3. }
  4. !include($$PWD/../dir2/dependency2.pri) {
  5. message("project.pro: can't find $$PWD/../dir2/dependency2.pri")
  6. }
To copy to clipboard, switch view to plain text mode 
As you can see, I make use of the undocumented PWD variable.

Have in mind that we are talking about 50 or more .pri files, which colud be nested (one pri including others)

But after reading better the qmake's documentation, and in my effor for doing this more generic, I thought about doing his:

Qt Code:
  1. THIS = project.pro
  2. ...
  3. DEPENDS = $$PWD/../dir1/dependency1.pri
  4. DEPENDS += $$PWD/../dir2/dependency2.pri
  5. for(d, DEPENDS):!include($$d):error($$THIS: can't find $$d)
To copy to clipboard, switch view to plain text mode 

The problem? well, the variable THIS is overwritten by the last included .pri before the one which failed. So, in short, what I would need is an undocumented variable which always contains the current .pro or .pri file name, just like PWD always contains the current .pro or .pri directory.

Does something like that exist? If not, could you please post your thoughts about including .pri(s) in a qmake project?

Thank you,

Juan Navarro