diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-04 14:43:39 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-08 16:05:44 +0000 |
commit | 021c17c62f963a682c6a4b19f0c3d362c28a97ee (patch) | |
tree | 4900dd2e2ddb2d1a5f35e20371f25d6556ba3c58 /cmake/QtSetup.cmake | |
parent | de3a806def4b9a754825a2233c9d4952a9b2d0eb (diff) |
Add support for -nomake-tests and -nomake-examples equivalents
A developer can pass either -DQT_NO_MAKE_TESTS=ON or
-DQT_NO_MAKE_EXAMPLES=ON to exclude tests or examples from being built
as part the default make target (when you write just make or ninja).
With ninja, tests and examples can be built separately one by one,
by typing
$ ninja tst_foo
or
$ ninja example_bar
Same can be done with the Makefile generator.
$ make tst_foo
All tests / examples can be built in one go by typing
$ ninja tests/all
or
$ ninja examples/all
With the Makefile generator unfortunately it's not as nice and is most
likely an implementation detail, but it can still be done by running
something like
$ make -f CMakeFiles/Makefile2 tests/all
or
$ make -f CMakeFiles/Makefile2 examples/all
Change-Id: I34f168b3ab41e952a21d3ace5634e25a9f41922e
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'cmake/QtSetup.cmake')
-rw-r--r-- | cmake/QtSetup.cmake | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 04b26d9596..f53388a27f 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -94,12 +94,14 @@ if(QT_BUILD_STANDALONE_TESTS) # building standalone tests. set(BUILD_TESTING ON CACHE BOOL "Build the testing tree." FORCE) endif() +option(QT_NO_MAKE_TESTS "Should tests be built as part of the default 'all' target." OFF) include(CTest) enable_testing() # Set up building of examples. option(BUILD_EXAMPLES "Build Qt examples" ON) +option(QT_NO_MAKE_EXAMPLES "Should examples be built as part of the default 'all' target." OFF) # Build Benchmarks option(QT_BUILD_BENCHMARKS "Build Qt Benchmarks" ${__build_benchmarks}) |