If you have a directory with existing source files, you can use qmake
with the -project
-option to create a project file.
Let's assume, the folder MyProgram contains the following files:
Then by calling
qmake -project
a file MyProgram.pro is created with the following content:
######################################################################
# Automatically generated by qmake (3.0) Mi. Sep. 7 23:36:56 2016
######################################################################
TEMPLATE = app
TARGET = MyProgram
INCLUDEPATH += .
# Input
HEADERS += bar.h foo.h subdir/foobar.h
SOURCES += bar.cpp foo.cpp main.cpp subdir/foobar.cpp
The code can then be built as described in this simple example.