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>
This commit is contained in:
parent
81fee7732d
commit
4e62517b9e
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user