summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2019-06-05 14:49:09 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-06-05 13:22:07 +0000
commit4e62517b9e72e7cb84e166134f90e06a83fdcf32 (patch)
treefc688a26aa0d56e78c18b0f847df703a3ccc9ca2
parent81fee7732d1096e3456de8b49cea592544f8ec85 (diff)
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 <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtSetup.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 769e17dfb8..e7ec66b322 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()