[Qt-creator] Changing make path depending on Kit or Qt Version

Tomasz Olszak olszak.tomasz at gmail.com
Thu Apr 10 10:47:58 CEST 2014

2014-04-10 9:09 GMT+02:00 Tobias Hunger <tobias.hunger at gmail.com>:
> On Apr 9, 2014 7:48 PM, "Tomasz Olszak" <olszak.tomasz at gmail.com> wrote:
>> 2014-04-09 19:36 GMT+02:00 Bartek TaczaƂa <bartek.taczala at gmail.com>:
>> > On Wednesday 09 of April 2014 15:25:18 Tomasz Olszak wrote:
>> >> Hi,
>> >> I would like to change make build step (make path) in qmake project
>> >> depending on Qt Version or Kit.
>> >> Is there any simple way to do that besides creating extra build
>> >> configuration factory like QmakeBuildConfigurationFactory?
> Creator will prepend the toolchain and Qt does to PATH, so putting your make
> in those directories might already be enough.
>> Anyway I've found out that I can overload
>> ProjectExplorer::GccToolChain::makeCommand to change the make path. It
>> is more neat than creating new build configuration factory only for
>> that purpose.
> That is considered to be a recommendation only. BuildSteps are free to
> ignore this.
> Best Regards,
> Tobias _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qt-creator

Thanks Tobias, I was aware of that. I'm trying to make POC of some
build configuration for Tizen. Tizen has so called gbs which builds
the projects in chroot and qemu. It is similar to obs[1] but can be
used locally. I came up with an idea that we could use native (e.g.
arm) qmake from gbs chroot directory.

I would like to provide an example:
Let's assume that
* sources of our aplication are in /home/user/sourcedir
* shadowbuild in /home/user/builddir.
* gbs chroot is /home/user/gbschrootdir

In gbschrootdir all qt packages(rpms) are installed with zypper, so we
have qmake in usr/bin, libraries in usr/lib plugins in
/usr/lib/qt5/plugins and so on.

I made qmake-gbs-host bash script which and place in

This script:
* invokes native qmake from gbs chroot and returns the output
* prepends /home/user/gbschrootdir to qmake variables when -query
argument is present
* before running native qmake it mounts --bind the /home/user/builddir
into /home/user/gbschrootdir/home/user/builddir and
/home/user/sourcedir into /home/user/gbschrootdir/home/user/sourcedir.

So that's how it works:
1. User adds new Qt version and choses
2. Qt creator autodetects toolchain in
/home/user/gbschrootdir/usr/bin/gcc and add this toolchain to
toolchain list. The toolchain has custom make command pointing to
/home/user/gbschrootdir/usr/bin/make-gbs-host which works the same as
qmake-gbs-host (mounts the needed directries in gbschroot dir and
invokes native make in chroot)
3. Qt creator creates Kit with gbs qt version and gbs toolchain

So when user uses Such GBS Kit he sees that in build steps
qmake-gbs-host and make-gbs-host are used.
So I can't use make from qmake-gbs-host directory because it's is
native (arm) make.

I would like to also notify these scripts about current source
directory by adding some parameter to qmake-gbs-host and make-gbs-host
invokation. I see it is possible with MakeStep::setUserArguments.

I also know that probably a lot of features will not work (like Qml
designer) but basic functionality related to building and showing
errors works. Perhaps I will need to make *-gbs-host wrapper for
/home/user/gbschrootdir/usr/bin/gcc is see that QtCreator tries to
invoke it in the background.

Any hints are very welcomed and appreciated as well as criticism.

[1] https://build.opensuse.org
Tomasz Olszak
Qt for Tizen | http://qt-project.org/wiki/Tizen

More information about the Qt-creator mailing list