From 40155ddd0ebec827b315549c5d528d8d3070f5fb Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 2 Feb 2022 17:04:44 +0100 Subject: [PATCH] configure: Allow specifying a comma separated list to -skip option This makes skipping a list of submodules more concise. e.g. instead of passing -skip qtsvg -skip qtimageformats -skip qtmultimedia pass -skip qtsvg,qtimageformats,qtmultimedia Pick-to: 6.2 6.3 Change-Id: I6a48828b2fd7cec9f6e19988f7b4033333768abb Reviewed-by: Alexey Edelev --- cmake/QtProcessConfigureArgs.cmake | 17 +++++++++++++++-- cmake/configure-cmake-mapping.md | 2 +- config_help.txt | 4 +++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 2440f636271..2a92ba6f830 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -25,6 +25,15 @@ macro(pop_path_argument) file(TO_CMAKE_PATH "${path}" path) endmacro() +function(is_non_empty_valid_arg arg value) + if(value STREQUAL "") + message(FATAL_ERROR "Value supplied to command line option '${arg}' is empty.") + elseif(value MATCHES "^-.*") + message(FATAL_ERROR + "Value supplied to command line option '${arg}' is invalid: ${value}") + endif() +endfunction() + if("${MODULE_ROOT}" STREQUAL "") # If MODULE_ROOT is not set, assume that we want to build qtbase or top-level. get_filename_component(MODULE_ROOT ".." ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") @@ -76,8 +85,12 @@ while(NOT "${configure_args}" STREQUAL "") elseif(arg STREQUAL "-write-options-for-conan") list(POP_FRONT configure_args options_json_file) elseif(arg STREQUAL "-skip") - list(POP_FRONT configure_args qtrepo) - push("-DBUILD_${qtrepo}=OFF") + list(POP_FRONT configure_args qtrepos) + is_non_empty_valid_arg("${arg}" "${qtrepos}") + list(TRANSFORM qtrepos REPLACE "," ";") + foreach(qtrepo IN LISTS qtrepos) + push("-DBUILD_${qtrepo}=OFF") + endforeach() elseif(arg STREQUAL "-qt-host-path") pop_path_argument() push("-DQT_HOST_PATH=${path}") diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md index 118371518db..7fd0efda17e 100644 --- a/cmake/configure-cmake-mapping.md +++ b/cmake/configure-cmake-mapping.md @@ -95,7 +95,7 @@ The following table describes the mapping of configure options to CMake argument | -android-style-assets | -DFEATURE_android_style_assets=ON | | | -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 | -DBUILD_=OFF | | +| -skip ,..., | -DBUILD_=OFF | | | -make | -DQT_BUILD_TESTS=ON | A way to turn on tools explicitly is missing. If tests/examples | | | -DQT_BUILD_EXAMPLES=ON | are enabled, you can disable their building as part of the | | | | 'all' target by also passing -DQT_BUILD_TESTS_BY_DEFAULT=OFF or | diff --git a/config_help.txt b/config_help.txt index 839a21bb614..941602eb17c 100644 --- a/config_help.txt +++ b/config_help.txt @@ -167,7 +167,9 @@ Build environment: Component selection: - -skip ......... Exclude an entire repository from the build. + -skip [,] Exclude one or more entire repositories from the + build. The list should be separated with commas. + e.g. -skip qtimageformats,qtsvg -make ......... Add to the list of parts to be built. Specifying this option clears the default list first. (allowed values: libs, tools, examples, tests,