For my Qt project, I use a .pro file that includes a separate .pri file for the various header, source, form and resource files. However, every time I add a new file I need
Running qmake -project
from the directory will create a project file that includes all the .cpp and .h files in that directory. You could add a pre-compile step that calls qmake -project
, then pass the generated file to a script that removes the first few lines. Here's a quick one-liner that could do the job :
qmake -project -o MyFiles.pro && sed '1,/^# Input/d' MyFiles.pro > MyFiles.pri && rm MyFiles.pro
You can use:
SOURCES += *.cpp
HEADERS += *.h
in your pro file. Of course you still have to remember to re-run qmake after creating new files.