Results 1 to 6 of 6

Thread: How to update file list in qmake automatically

  1. #1
    Join Date
    Feb 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to update file list in qmake automatically

    Hello all,

    if I have a pro file
    What is the best way to update the SOURCES and HEADERS
    automatically based on the file in the subdirs


    thanx
    Eli

  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: How to update file list in qmake automatically

    You should be able to do:
    qmake Code:
    1. SOURCES+=*.cpp
    2. HEADERS+=*.h
    To copy to clipboard, switch view to plain text mode 

    But you still have to rerun qmake after creating a new file.
    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
    Feb 2008
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to update file list in qmake automatically

    thanx!

    but its only works for files in the current directory
    I need a solution for all sub directories

  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: How to update file list in qmake automatically

    qmake can't do that. Unless you add a .pri file into each directory and include each of them from your .pro file. But then if you want to add another directory, you have to include its pri file again.
    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
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to update file list in qmake automatically

    qmake can do it. first shot is

    SOURCES += $$system("find . -name '*.cpp'")
    HEADERS += $$system("find . -name '*.h'")

  6. #6
    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: How to update file list in qmake automatically

    Which will happily add all moc and uic generated files as well... and will cause the whole directory tree to be rescanned upon every call to qmake. Let's not automate things too much guys.
    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.


Similar Threads

  1. How can we create .pc file automatically?
    By learning_qt in forum Qt Programming
    Replies: 6
    Last Post: 9th December 2010, 06:19
  2. Replies: 1
    Last Post: 11th November 2009, 18:28
  3. getting a file extenstion list from a MIME type
    By roxton in forum Qt Programming
    Replies: 0
    Last Post: 10th April 2009, 19:27
  4. How to Update in .ini file?
    By phillip_Qt in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2008, 14:40
  5. :eek: qmake does not update my app
    By popoholic in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2006, 07:24

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.