qt5base-lts/bin
Alexandru Croitor 1f442c684f CMake: Provide script to configure and build one or more tests
Before this patch there were a few ways to build tests
- Configure all tests as part of the repo build
- Configure all tests as part of the repo build, but don't build
  tests by default (-DQT_NO_MAKE_TESTS=ON)
- Configure all tests as a standalone project in a separate build
  dir using -QT_BUILD_STANDALONE_TESTS=ON

All of the above incur some time overhead due to the necessity
of configuring all tests.
Sometimes you just want to build ONE test (or a few).

To facilitate that use case, a new shell script called
bin/qt-cmake-standalone-test(.bat) can now be used to configure
and build one or more tests.

The script takes one single argument pointing to the desired test
project path and configures a generic template project that sets up
all the necessary Qt CMake private API, afterwards calling
add_subdirectory on the passed in project.

Example
$ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image/qicon

or

$ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image

After that, simply run 'ninja && ctest' to build and run the test(s).

This is the CMake equivalent of calling qmake on a test .pro file
(or on a tests SUBDIRS .pro file)

There are 3 details worth mentioning.

Due to the add_subdirectory call, the built artifacts will not
be in the top-level build dir, but rather in a nested build_dir.

The script currently can't handle more than one argument
(the path to the project), so you can't pass additional
-DFoo=bar arguments.

If a test uses a 3rd party library (like Threads::Threads)
which was not a public dependency for any of the Qt modules,
configuration will fail saying that the target was not found.
Perhaps we should consider recording these packages when
generating the StandaloneConfig.cmake files.

Change-Id: Icde6ecb839341d34f341d9a19402c91196ed5aa0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-23 09:54:48 +01:00
..
fixqt4headers.pl Updated license headers 2016-01-15 12:25:24 +00:00
qt-cmake-standalone-test.in CMake: Provide script to configure and build one or more tests 2020-03-23 09:54:48 +01:00
qt-cmake.bat.in Add initial support for CMake "Ninja Multi-Config" generator 2020-01-27 11:47:57 +00:00
qt-cmake.in Add initial support for CMake "Ninja Multi-Config" generator 2020-01-27 11:47:57 +00:00
syncqt.pl Merge remote-tracking branch 'origin/5.13' into 5.14 2019-11-13 07:21:33 +01:00