Qmake and Rebuild all
Please explain how these buttons work in Qtcreator'e.
I read in several guides that qmake executes pro files. These are files that describe how to build a project into a working program (roughly speaking). I haven't seen any info about Rebuild all anywhere.
I tested it many times on my computer, and found out that Rebuild All performs everything that is written in the pro files, except for functions. And qmake only performs functions. Did I get it right or does it depend on some settings? Can I configure it to perform both actions with a single button?
What exactly does each of the buttons do? On the Internet, the information about this is blurry, as if everyone knows it, and it goes without saying.
Example: The project has an iss_generator.pri file. It is connected to the pro file as follows.
include(iss_generator.pri)
Here is the code of this file.
iss_file = $$DeployDir/install.iss
iss ="Здесь большой текст этого файла"
write_file($$iss_file, iss)
The file appears in the folder only with qmake. When build does not appear.
1 answers
The assembly system based on qmake
is two - phase.
- The phase of generating build scripts (projects). The menu item
Build -> Run qmake
is responsible for this phase (or you can start it). Or, if the build scripts have not yet been created, then this phase starts automatically. Accordingly, if you already have a build directory, then when you change it.pro
/.pri
for example, you must callBuild -> Run qmake
yourself. - Project build phase. This is either
Build All
(incremental build), orRebuild All
.
To automatically generate build scripts, you can do this hack:
QMAKE_EXTRA_TARGETS += after_build firsthook
firsthook.target = first
firsthook.depends = after_build
after_build.depends = all
after_build.CONFIG = phony
after_build.commands = $(DEL_FILE) $(MAKEFILE)
That is, after each build, the build script will be deleted, and Qt Creator will run qmake
itself at each Build All
.
Also, see a good guide to qmake.
Update
If there are any goals (target) that are executed after building everything, then they should be added to the dependencies after_build.depend
after_build.depend = all <список всех целей выполняемых после сборки>
So that the goal after_build
is the most the last command executed.