summaryrefslogtreecommitdiffstats
path: root/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
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')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake10
-rw-r--r--cmake/QtBuildInternalsExtra.cmake.in8
-rw-r--r--cmake/QtPriHelpers.cmake4
-rw-r--r--cmake/QtProcessConfigureArgs.cmake8
-rw-r--r--cmake/QtSetup.cmake34
-rw-r--r--cmake/QtToolHelpers.cmake8
-rw-r--r--cmake/README.md2
-rw-r--r--cmake/configure-cmake-mapping.md8
8 files changed, 41 insertions, 41 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index a7b86ed606..5216cebf66 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -372,7 +372,7 @@ macro(qt_build_repo)
# If testing is enabled, try to find the qtbase Test package.
# Do this before adding src, because there might be test related conditions
# in source.
- if (BUILD_TESTING AND NOT QT_BUILD_STANDALONE_TESTS)
+ if (QT_BUILD_TESTS AND NOT QT_BUILD_STANDALONE_TESTS)
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test)
endif()
@@ -386,20 +386,20 @@ macro(qt_build_repo)
endif()
endif()
- if (BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt")
+ if (QT_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt")
add_subdirectory(tests)
- if(QT_NO_MAKE_TESTS)
+ if(NOT QT_BUILD_TESTS_BY_DEFAULT)
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()
qt_build_repo_end()
- if (BUILD_EXAMPLES AND BUILD_SHARED_LIBS
+ if(QT_BUILD_EXAMPLES AND BUILD_SHARED_LIBS
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt"
AND NOT QT_BUILD_STANDALONE_TESTS)
add_subdirectory(examples)
- if(QT_NO_MAKE_EXAMPLES)
+ if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
set_property(DIRECTORY examples PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()
diff --git a/cmake/QtBuildInternalsExtra.cmake.in b/cmake/QtBuildInternalsExtra.cmake.in
index 5f58d4e79f..66f11a4364 100644
--- a/cmake/QtBuildInternalsExtra.cmake.in
+++ b/cmake/QtBuildInternalsExtra.cmake.in
@@ -39,11 +39,11 @@ 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")
-set(QT_NO_MAKE_TESTS @QT_NO_MAKE_TESTS@ CACHE BOOL
+set(QT_BUILD_TESTS @QT_BUILD_TESTS@ CACHE BOOL "Build the testing tree.")
+set(QT_BUILD_EXAMPLES @QT_BUILD_EXAMPLES@ CACHE BOOL "Build Qt examples")
+set(QT_BUILD_TESTS_BY_DEFAULT @QT_BUILD_TESTS_BY_DEFAULT@ CACHE BOOL
"Should tests be built as part of the default 'all' target.")
-set(QT_NO_MAKE_EXAMPLES @QT_NO_MAKE_EXAMPLES@ CACHE BOOL
+set(QT_BUILD_EXAMPLES_BY_DEFAULT @QT_BUILD_EXAMPLES_BY_DEFAULT@ CACHE BOOL
"Should examples be built as part of the default 'all' target.")
# Propagate usage of ccache.
diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake
index 7d4b6143ec..e0f10d19bb 100644
--- a/cmake/QtPriHelpers.cmake
+++ b/cmake/QtPriHelpers.cmake
@@ -642,11 +642,11 @@ endfunction()
function(qt_get_build_parts out_var)
set(parts "libs")
- if(BUILD_EXAMPLES AND NOT QT_NO_MAKE_EXAMPLES)
+ if(QT_BUILD_EXAMPLES AND QT_BUILD_EXAMPLES_BY_DEFAULT)
list(APPEND parts "examples")
endif()
- if(BUILD_TESTING AND NOT QT_NO_MAKE_TESTS)
+ if(QT_BUILD_TESTS AND QT_BUILD_TESTS_BY_DEFAULT)
list(APPEND parts "tests")
endif()
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake
index e8672306dd..258a4a09e1 100644
--- a/cmake/QtProcessConfigureArgs.cmake
+++ b/cmake/QtProcessConfigureArgs.cmake
@@ -664,11 +664,11 @@ drop_input(nomake)
foreach(part ${INPUT_nomake})
if("${part}" STREQUAL "tests")
- push("-DBUILD_TESTING=OFF")
+ push("-DQT_BUILD_TESTS=OFF")
continue()
endif()
if("${part}" STREQUAL "examples")
- push("-DBUILD_EXAMPLES=OFF")
+ push("-DQT_BUILD_EXAMPLES=OFF")
continue()
endif()
qtConfAddWarning("'-nomake ${part}' is not implemented yet.")
@@ -676,11 +676,11 @@ endforeach()
foreach(part ${INPUT_make})
if("${part}" STREQUAL "tests")
- push("-DBUILD_TESTING=ON")
+ push("-DQT_BUILD_TESTS=ON")
continue()
endif()
if("${part}" STREQUAL "examples")
- push("-DBUILD_EXAMPLES=ON")
+ push("-DQT_BUILD_EXAMPLES=ON")
continue()
endif()
if("${part}" STREQUAL "tools")
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})
diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake
index 3d9d53c49b..4cca2990f3 100644
--- a/cmake/QtToolHelpers.cmake
+++ b/cmake/QtToolHelpers.cmake
@@ -417,11 +417,11 @@ function(qt_check_if_tools_will_be_built)
endfunction()
# Equivalent of qmake's qtNomakeTools(directory1 directory2).
-# If QT_NO_MAKE_TOOLS is true, then targets within the given directories will be excluded from the
-# default 'all' target, as well as from install phase.
-# The private variable is checked by qt_internal_add_executable.
+# If QT_BUILD_TOOLS_BY_DEFAULT is true, then targets within the given directories will be excluded
+# from the default 'all' target, as well as from install phase. The private variable is checked by
+# qt_internal_add_executable.
function(qt_exclude_tool_directories_from_default_target)
- if(QT_NO_MAKE_TOOLS)
+ if(NOT QT_BUILD_TOOLS_BY_DEFAULT)
set(absolute_path_directories "")
foreach(directory ${ARGV})
list(APPEND absolute_path_directories "${CMAKE_CURRENT_SOURCE_DIR}/${directory}")
diff --git a/cmake/README.md b/cmake/README.md
index 8a3ba27c3c..eaaa781380 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -128,7 +128,7 @@ machine you're building on, regardless of the architecure you are targeting.
Build Qt regularly for your host system and install it into a directory of your choice using the
``CMAKE_INSTALL_PREFIX`` variable. You are free to disable the build of tests and examples by
-passing ``-DBUILD_EXAMPLES=OFF`` and ``-DBUILD_TESTING=OFF``.
+passing ``-DQT_BUILD_EXAMPLES=OFF`` and ``-DQT_BUILD_TESTS=OFF``.
With this installation of Qt in place, which contains all tools needed, we can proceed to create a
new build of Qt that is cross-compiled to the target architecture of choice. You may proceed by
diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md
index b5e528f1e2..2f669aad9a 100644
--- a/cmake/configure-cmake-mapping.md
+++ b/cmake/configure-cmake-mapping.md
@@ -102,10 +102,10 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349.
| -android-javac-source | -DQT_ANDROID_JAVAC_SOURCE=7 | Set the javac build source version. |
| -android-javac-target | -DQT_ANDROID_JAVAC_TARGET=7 | Set the javac build target version. |
| -skip <repo> | -DBUILD_<repo>=OFF | |
-| -make <part> | -DBUILD_TESTING=ON | A way to turn on tools explicitly is missing. |
-| | -DBUILD_EXAMPLES=ON | |
-| -nomake <part> | -DBUILD_TESTING=OFF | A way to turn off tools explicitly is missing. |
-| | -DBUILD_EXAMPLES=OFF | |
+| -make <part> | -DQT_BUILD_TESTS=ON | A way to turn on tools explicitly is missing. |
+| | -DQT_BUILD_EXAMPLES=ON | |
+| -nomake <part> | -DQT_BUILD_TESTS=OFF | A way to turn off tools explicitly is missing. |
+| | -DQT_BUILD_EXAMPLES=OFF | |
| -no-gui | | |
| -no-widgets | -DFEATURE_widgets=OFF | |
| -no-dbus | -DFEATURE_dbus=OFF | |