Qmake and recursive include directories

  • Hi -

    Anyone know of a way to recursively add all subdirectories of a directory in my project to the INCLUDEPATH? I just want all the directories in my project to get searched for include purposes.


  • If your directory structure is like Project/Include , Project/Source , Project/Build/ , and your .pri file is in the Project/Build/ directory , i think adding "INCLUDEPATH += ../Include/" in .pri should work.

  • Let say I have a directory called src, where all my code exists, like this:

    ... etc

    What I'm looking for is a way to add all the sub dirs of /src to the INCLUDEPATH without manually typing them all in. Seems like there should be some way of using qmake functions to loop over these dirs.


  • Doesnt INCLUDEPATH + = ../src work for you ?

  • No it doesn't search all the subdirectories, you have to actually add every specific dir underneath.

  • I'm having same issue; how did you resolve it?

  • You have to add 'em all manually. I did it by adding subproject files (.pri by convention) which add all the source and header and incl paths for a particular component. Then in my main .pro file you can use the include directive.

    This could probably be scripted in qmake language. I'm too lazy for that.

  • Is there any efficient way to handle this?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.