The build and install directories are separate concepts. If you merely build, you should not expect anything to get actually installed.
In Qt Creator, when you have a qmake-based project, the default build setup invokes make
. To install, you need to then invoke make install
. This can be added as an additional build step in the project's "Build and Run" tab.
With qmake, there is no default location for the install directory, and no objects are declared to be installed, so make install
is a no-op by default.
The files to be installed need to be:
- Set up as a qmake object.
- The object has to be added to the
INSTALLS
variable.
For example:
# Sets the default installation prefix to the build directory.
# This is the same default that Qt's configuration process uses.
!defined(PREFIX,var): PREFIX = $$OUT_PWD
MY_RESOURCES = \
MyJsonFile.json \
MyTxtFile.txt \
ReadMe.txt
OTHER_SOURCES += $$MY_RESOURCES
# Object describing the resources to install
my_resources.path = $$PREFIX/share/myproject
my_resources.files = $$MY_RESOURCES
# The automatically generated object describing the target.
target.path = $$PREFIX/bin/myproject
# Declare my_resources and target objects to be installed.
INSTALLS += my_resources target
The user or package manager script is supposed to give the desired install prefix to qmake. A complete build done in an empty build directory (a so-called shadow build) would look like:
# on Unix
qmake "PREFIX=/usr/local" /sourcedir/myproject.pro
# on Windows (the installation into Program Files won't
# be done by make, but by an installer!)
qmake /sourcedir/myproject.pro
make
make install