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. Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit fb21a5ce1a5831fab2af5e4d301600d6a6211e5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c1f9e6ce98
commit
4cd9ac52ed
@ -96,9 +96,9 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
|
||||
add_subdirectory(src)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
if(QT_BUILD_TESTS)
|
||||
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()
|
||||
@ -129,9 +129,9 @@ endif()
|
||||
|
||||
qt_build_repo_end()
|
||||
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS AND BUILD_EXAMPLES)
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS AND QT_BUILD_EXAMPLES)
|
||||
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()
|
||||
|
@ -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()
|
||||
|
@ -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.
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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})
|
||||
|
@ -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}")
|
||||
|
@ -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
|
||||
|
@ -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 | |
|
||||
|
@ -19,7 +19,7 @@ instructions:
|
||||
- type: EnvironmentVariable
|
||||
variableName: COIN_CMAKE_ARGS
|
||||
# The lack of space between the non qtbase configure args and the rest of the args is important!
|
||||
variableValue: "{{.Env.NON_QTBASE_CONFIGURE_ARGS}} -DBUILD_TESTING=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
variableValue: "{{.Env.NON_QTBASE_CONFIGURE_ARGS}} -DQT_BUILD_TESTS=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
- !include "{{qt/qtbase}}/call_host_cmake.yaml"
|
||||
- type: ExecuteCommand
|
||||
command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v"
|
||||
@ -49,7 +49,7 @@ instructions:
|
||||
- type: EnvironmentVariable
|
||||
variableName: COIN_CMAKE_ARGS
|
||||
# The lack of space between the non qtbase configure args and the rest of the args is important!
|
||||
variableValue: "{{.Env.NON_QTBASE_TARGET_CONFIGURE_ARGS}} -DBUILD_TESTING=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
variableValue: "{{.Env.NON_QTBASE_TARGET_CONFIGURE_ARGS}} -DQT_BUILD_TESTS=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
- !include "{{qt/qtbase}}/call_target_cmake.yaml"
|
||||
- type: ExecuteCommand
|
||||
command: "{{.Env.TARGET_ENV_PREFIX}} cmake --build . --parallel -v"
|
||||
|
@ -17,7 +17,7 @@ instructions:
|
||||
- type: ChangeDirectory
|
||||
directory: "{{.BuildDir}}"
|
||||
- type: ExecuteCommand
|
||||
command: "{{.Env.ENV_PREFIX}} cmake {{.Env.CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/host -DBUILD_TESTING=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
command: "{{.Env.ENV_PREFIX}} cmake {{.Env.CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/host -DQT_BUILD_TESTS=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
|
||||
maxTimeInSeconds: 6000
|
||||
maxTimeBetweenOutput: 1200
|
||||
@ -63,7 +63,7 @@ instructions:
|
||||
property: platformDependency
|
||||
equals_value: null
|
||||
- type: ExecuteCommand
|
||||
command: "{{.Env.TARGET_ENV_PREFIX}} cmake {{.Env.TARGET_CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/target -DBUILD_TESTING=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
command: "{{.Env.TARGET_ENV_PREFIX}} cmake {{.Env.TARGET_CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/target -DQT_BUILD_TESTS=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
|
||||
maxTimeInSeconds: 6000
|
||||
maxTimeBetweenOutput: 1200
|
||||
|
@ -9,7 +9,7 @@ instructions:
|
||||
- type: EnvironmentVariable
|
||||
variableName: COIN_CMAKE_ARGS
|
||||
# The lack of space between the non qtbase configure args and the rest of the args is important!
|
||||
variableValue: "{{.Env.NON_QTBASE_CONFIGURE_ARGS}} -DBUILD_TESTING=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
variableValue: "{{.Env.NON_QTBASE_CONFIGURE_ARGS}} -DQT_BUILD_TESTS=OFF -DCMAKE_AUTOGEN_VERBOSE=ON {{.SourceDir}}"
|
||||
- !include "{{qt/qtbase}}/call_cmake.yaml"
|
||||
- type: ExecuteCommand
|
||||
command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v"
|
||||
|
@ -7,7 +7,7 @@ instructions:
|
||||
- type: ChangeDirectory
|
||||
directory: "{{.BuildDir}}"
|
||||
- type: ExecuteCommand
|
||||
command: "{{.Env.ENV_PREFIX}} cmake {{.Env.CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}} -DBUILD_TESTING=OFF {{.SourceDir}}"
|
||||
command: "{{.Env.ENV_PREFIX}} cmake {{.Env.CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}} -DQT_BUILD_TESTS=OFF {{.SourceDir}}"
|
||||
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
|
||||
maxTimeInSeconds: 6000
|
||||
maxTimeBetweenOutput: 1200
|
||||
|
Loading…
x
Reference in New Issue
Block a user