Propagate BUILD_TESTING and BUILD_EXAMPLES

As with qmake, you configure with or without -nomake tests -nomake
examples, and the choice is propagated to other repositories.

Do the same for CMake. It's still possible to opt out to build one
or the other by passing -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
on the command line, which takes precedence over the value saved to
QtBuildInternalsExtra.

Change-Id: If0fbfa938d88309e7969c9bacc8d0bf86548bf5e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Alexandru Croitor 2019-09-06 11:52:47 +02:00
parent b28c2c9528
commit bf899ba53b
3 changed files with 8 additions and 2 deletions

View File

@ -69,7 +69,6 @@ qt_copy_or_install(DIRECTORY "${PROJECT_SOURCE_DIR}/mkspecs"
qt_build_repo_end()
option(BUILD_EXAMPLES "Build Qt examples" ON)
if (BUILD_EXAMPLES)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

View File

@ -23,5 +23,9 @@ set(QT_WILL_INSTALL @QT_WILL_INSTALL@ CACHE BOOL
set(QT_SOURCE_TREE "@QT_SOURCE_TREE@" CACHE PATH
"A path to the source tree of the previously configured QtBase project." FORCE)
# Propagate decision of building tests and examples to other repositories.
set(BUILD_TESTING @BUILD_TESTING@ CACHE BOOL "Build the testing tree.")
set(BUILD_EXAMPLES @BUILD_EXAMPLES@ CACHE BOOL "Build Qt examples")
# Extra set of exported variables
@QT_EXTRA_BUILD_INTERNALS_VARS@

View File

@ -87,6 +87,9 @@ option(BUILD_TESTING "Build the testing tree." ${QT_BUILD_TESTING})
include(CTest)
enable_testing()
# Set up building of examples.
option(BUILD_EXAMPLES "Build Qt examples" ON)
## Define some constants to check for certain platforms, etc:
include(QtPlatformSupport)