From 4e62517b9e72e7cb84e166134f90e06a83fdcf32 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 5 Jun 2019 14:49:09 +0200 Subject: [PATCH] CMake: Disable autotests for non-developer builds Mimic the behavior in the qmake build system, and by default build tests for developer-build, and not build it for a normal build. To do this, we define BUILD_TESTING with the right default before including CTest, which does otherwise define the option itself. Change-Id: Ifa1b1156477919abc1e916ccd9e1e0a74e969ee6 Reviewed-by: Alexandru Croitor --- cmake/QtSetup.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 769e17dfb85..e7ec66b322e 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -41,6 +41,7 @@ if(FEATURE_developer_build) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) endif() set(QT_WILL_INSTALL OFF) + set(QT_BUILD_TESTING ON) # Handle non-prefix builds by setting the cmake install prefix to the project binary dir. if(PROJECT_NAME STREQUAL "QtBase") set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH @@ -51,9 +52,11 @@ if(FEATURE_developer_build) endif() else() set(QT_WILL_INSTALL ON) + set(QT_BUILD_TESTING OFF) endif() -## Enable testing: +## Set up testing +option(BUILD_TESTING "Build the testing tree." ${QT_BUILD_TESTING}) include(CTest) enable_testing()