10 Jun 2017

Prevent qmake from installing test cases

If you use qmake to build your Qt based projects and at the same time the QtTest framework to write unit tests, you might have run into a strange behavior:

Generated Makefiles have an installs feature, which mainly is used on Unix like operating systems to install a previously compiled project. Normally you would expect the installs feature only puts your libraries and executable files into the target location. However, unit tests also get installed by default - which, usually, is not what’s wanted, right?

Fortunately, it’s quite easy to tell qmake not to install unit tests by default, simply add the no_testcase_installs configuration switch to your unit test’s .pro file:

TARGET   = my_unit_test
CONFIG  += console testcase no_testcase_installs
QT      += testlib
# ...

That should already do the trick ;-)

Thank You For Reading
Martin Hoeher

I am a software/firmware developer, working in Dresden, Germany. In my free time, I spent some time on developing apps, presenting some interesting findings here in my blog.

Your comment has been filed

We'll review it and it will appear here as soon as we're done.

Sorry, something went wrong...

Your comment could not be posted.

Regarding your personal information...
  • The name you enter will be shown next to your comment. You may enter your real name or whatever you like.
  • Your e-mail will be used to show an image representing you next to your comment. We do not store nor show your address somewhere. Instead, an ID will be calculated from it and stored. This ID is then used to retrieve an image from Gravatar.