summaryrefslogtreecommitdiffstats
path: root/cmake/QtSetup.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-10-19 13:35:15 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-11-20 20:38:03 +0100
commitfb21a5ce1a5831fab2af5e4d301600d6a6211e5d (patch)
treeb4fdb21ea8c58c352c26383505f958b1a6ac9967 /cmake/QtSetup.cmake
parent47778847ec103242ee95b01d502272d6a9879e9b (diff)
CMake: Name QT_NO_MAKE_*/BUILD_* variables consistently
For consistency, apply the following renamings: QT_NO_MAKE_EXAMPLES -> QT_BUILD_EXAMPLES_BY_DEFAULT QT_NO_MAKE_TESTS -> QT_BUILD_TESTS_BY_DEFAULT QT_NO_MAKE_TOOLS -> QT_BUILD_TOOLS_BY_DEFAULT BUILD_EXAMPLES -> QT_BUILD_EXAMPLES BUILD_TESTING -> QT_BUILD_TESTS This should help to better convey the difference between "BUILD" and "NO_MAKE". To configure tests, but not to build them by default, pass the following to CMake: -DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF Analoguous for examples: -DQT_BUILD_EXAMPLES=ON -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF Tools can be excluded from the default build with: -DBUILD_TOOLS_BY_DEFAULT=OFF The variable BUILD_TESTING is still available and initialized with the value of QT_BUILD_TESTS. Pick-to: 6.0 6.0.0 Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtSetup.cmake')
-rw-r--r--cmake/QtSetup.cmake34
1 files changed, 17 insertions, 17 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 025c0ab425..56684e7e02 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -106,13 +106,13 @@ if(FEATURE_developer_build)
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
- set(QT_BUILD_TESTING ON)
+ set(_qt_build_tests_default ON)
set(__build_benchmarks ON)
# Tests are not built by default with qmake for iOS and friends, and thus the overall build
# tends to fail. Disable them by default when targeting uikit.
if(UIKIT OR ANDROID)
- set(QT_BUILD_TESTING OFF)
+ set(_qt_build_tests_default OFF)
endif()
# Disable benchmarks for single configuration generators which do not build
@@ -121,41 +121,41 @@ if(FEATURE_developer_build)
set(__build_benchmarks OFF)
endif()
else()
- set(QT_BUILD_TESTING OFF)
+ set(_qt_build_tests_default OFF)
set(__build_benchmarks OFF)
endif()
## Set up testing
-option(BUILD_TESTING "Build the testing tree." ${QT_BUILD_TESTING})
+option(QT_BUILD_TESTS "Build the testing tree." ${_qt_build_tests_default})
+unset(_qt_build_tests_default)
+option(QT_BUILD_TESTS_BY_DEFAULT "Should tests be built as part of the default 'all' target." ON)
if(QT_BUILD_STANDALONE_TESTS)
- set(QT_BUILD_TESTING ON)
-
# BuildInternals might have set it to OFF on initial configuration. So force it to ON when
# building standalone tests.
- set(BUILD_TESTING ON CACHE BOOL "Build the testing tree." FORCE)
+ set(QT_BUILD_TESTS ON CACHE BOOL "Build the testing tree." FORCE)
# Also force the tests to be built as part of the default build target.
- set(QT_NO_MAKE_TESTS OFF CACHE BOOL
- "Should examples be built as part of the default 'all' target." FORCE)
+ set(QT_BUILD_TESTS_BY_DEFAULT ON CACHE BOOL
+ "Should tests be built as part of the default 'all' target." FORCE)
endif()
-option(QT_NO_MAKE_TESTS "Should tests be built as part of the default 'all' target." OFF)
+set(BUILD_TESTING ${QT_BUILD_TESTS} CACHE INTERNAL "")
# When cross-building, we don't build tools by default. Sometimes this also covers Qt apps as well.
# Like in qttools/assistant/assistant.pro, load(qt_app), which is guarded by a qtNomakeTools() call.
-set(qt_no_make_tools_default OFF)
+set(_qt_build_tools_by_default_default ON)
if(CMAKE_CROSSCOMPILING AND NOT QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
- set(qt_no_make_tools_default ON)
+ set(_qt_build_tools_by_default_default OFF)
endif()
-option(QT_NO_MAKE_TOOLS "Should tools be built as part of the default 'all' target."
- "${qt_no_make_tools_default}")
-unset(qt_no_make_tools_default)
+option(QT_BUILD_TOOLS_BY_DEFAULT "Should tools be built as part of the default 'all' target."
+ "${_qt_build_tools_by_default_default}")
+unset(_qt_build_tools_by_default_default)
include(CTest)
enable_testing()
-option(BUILD_EXAMPLES "Build Qt examples" OFF)
-option(QT_NO_MAKE_EXAMPLES "Should examples be built as part of the default 'all' target." OFF)
+option(QT_BUILD_EXAMPLES "Build Qt examples" OFF)
+option(QT_BUILD_EXAMPLES_BY_DEFAULT "Should examples be built as part of the default 'all' target." ON)
# Build Benchmarks
option(QT_BUILD_BENCHMARKS "Build Qt Benchmarks" ${__build_benchmarks})