Results 1 to 8 of 8

Thread: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

  1. #1
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Unhappy QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    Dear Community,

    I am since a while trying to include all header files of my ITK library located in /usr/include/InsightToolkit/... However, this library is pretty big and contains around 50-100 sub directories. So what I did until now is writing
    INCLUDEPATH += /usr/include/InsightToolkit/XY; /usr/include/InsightToolkit/XZ; ... but this is getting frustrating. Isn't there an elegant way? I was search for this in Google now for 3 hours without any result! I mean there are many people asking for this but I haven't seen a useful answer so far. I can't believe one can not include the sub directories automatically.

    One of the answers were (also from this forum):

    "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."

    I do not even understand what is meant by adding subproject files .pri.


    Thanks for any help

    Nathi

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    You should only add the top level directory to INCLUDEPATH and when including files use paths relative to that directory, e.g. #include <XY/sometime.h>
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    Sorry but this is not helpful. I use a relative huge library and I need many classes of hit since I will write a complex project. I will definitely not include every time I need a new class include it search for its path. The library contains around 7 basic folders, most of these contain again 5 sub folders, these again contain 10 sub folders. It is insane that there is no other way. Moreover I will add more huge libraries such as VTK.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    Quote Originally Posted by Nathalia View Post
    I will definitely not include every time I need a new class include it search for its path.
    That is a standard approach for every library I know of.

    And you definitely don't want your compiler to search for every include file in thousands of directories. Unless you are paid by an hour and don't care that the compilation takes 10 times as long as needed.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    Thats quite true, do you really to include so many headers as Wysota asked ?

    If yes, you can save time by listing headers from a command prompt, include the result in INCLUDEPATH in some text editor
    find . -names *.h
    // Open in text editor and extract directory by removing file names [hint : reg ex for header like "/[A-Z ]+\.h" ]

  6. #6
    Join Date
    Mar 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    Thank you, that helped me a lot. I just have basic issues getting an overview of how linux works since so many things are done by command window.

    Thanks.
    Nathi

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    Using include statements in your C/C++ code is nothing Linux specific.

    One more thing, be prepared that if you spit out thousand directories on your compiler's command-line, you will get an error about the line being too long. What you are trying to do is really Bad And Evilâ„¢.

    If you are lazy then create an include file where you will list all the include files you may use (with full paths relative to some directory in INCLUDEPATH) and always include that file in your code. Your project will still build very slowly but at least you won't be getting errors on the command line.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QMake INCLUDEPATH Recursively search in all Subdirectories (ITK Setup)

    VTK, ITK, and the other kits from KitWare are designed to use CMake. Build conditions are specified using CMakeLists.txt files, which can be processed using the CMake-gui tool.

    Once you have a correct CMakeLists.txt file, you can import this into Qt Creator and generate the .pro / Makefile file from it.

    In the VTK Cylinder example, all of the header files needed to build the program are included without any need to specify the directories in which they are found, because CMake takes care of all of that.

    But you seem intent on doing things the hard way.

Similar Threads

  1. qmake HEADERS/SOURCES and INCLUDEPATH
    By conti in forum Newbie
    Replies: 2
    Last Post: 28th January 2012, 18:29
  2. Replies: 1
    Last Post: 2nd December 2008, 11:31
  3. another qmake INCLUDEPATH spaces problem
    By mmueller in forum Qt Programming
    Replies: 4
    Last Post: 31st July 2008, 14:12
  4. qmake + subdirectories
    By niko in forum Qt Programming
    Replies: 9
    Last Post: 14th April 2007, 18:50
  5. qmake INCLUDEPATH with spaces
    By bitChanger in forum Qt Programming
    Replies: 8
    Last Post: 28th April 2006, 05:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.