[Development] How to build unit tests & examples on demand with Qt6/CMake?

Thiago Macieira thiago.macieira at intel.com
Mon Nov 16 20:58:17 CET 2020

On Monday, 16 November 2020 11:19:11 PST Alexandru Croitor wrote:
> With the configure line you posted, all tests will be configured and built
> as part of the default 'all' target.
> If you wish the default all target not to build all tests (but still
> configure the tests and build them manually / explicitly), you can
> configure with -DQT_NO_MAKE_TESTS=ON. Note the option might be renamed soon
> https://codereview.qt-project.org/c/qt/qtbase/+/318032
> Ninja has special targets to build all targets under a directory.
> e.g. ninja tests/auto/gui/all
> You can also build a specific test by name
> ninja tst_qmake
> ninja tst_qmake_check (builds and runs the test)

Thanks, Alexandru and the folks in IRC (Jörg, Sergio).

Looks like I needed to add the option above and remove the -DBUILD_TESTING=OFF 

> If you want to build tests out-of-tree aka not part of the Qt build
> (standalone tests), there's the script in
> $prefix/bin/qt-cmake-standalone-test

Good to know, but it's working without that now.
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering

More information about the Development mailing list