From 30a9b045cc6421b19898b070ed2cebaf734df174 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 5 Nov 2020 15:50:57 +0100 Subject: CMake: Implement configure -list-features Extend qt_configure_get_padded_string to make the feature list look like qmake's. Fixes: QTBUG-88144 Change-Id: I714f2b2f3537b506365a03b5b6bc3413e9cab167 Reviewed-by: Alexandru Croitor --- cmake/QtBuildInformation.cmake | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'cmake/QtBuildInformation.cmake') diff --git a/cmake/QtBuildInformation.cmake b/cmake/QtBuildInformation.cmake index 5a76b2070c..50ace2ea5d 100644 --- a/cmake/QtBuildInformation.cmake +++ b/cmake/QtBuildInformation.cmake @@ -140,13 +140,32 @@ macro(qt_configure_add_report_padded label message) set(__qt_configure_reports "${__qt_configure_reports}" PARENT_SCOPE) endmacro() +# Pad 'label' and 'value' with dots like this: +# "label ............... value" +# +# PADDING_LENGTH specifies the number of characters from the start to the last dot. +# Default is 30. +# MIN_PADDING specifies the minimum number of dots that are used for the padding. +# Default is 0. function(qt_configure_get_padded_string label value out_var) - set(pad_string ".........................................") + cmake_parse_arguments(arg "" "PADDING_LENGTH;MIN_PADDING" "" ${ARGN}) + if("${arg_MIN_PADDING}" STREQUAL "") + set(arg_MIN_PADDING 0) + endif() + if(arg_PADDING_LENGTH) + set(pad_string "") + math(EXPR n "${arg_PADDING_LENGTH} - 1") + foreach(i RANGE ${n}) + string(APPEND pad_string ".") + endforeach() + else() + set(pad_string ".........................................") + endif() string(LENGTH "${label}" label_len) string(LENGTH "${pad_string}" pad_len) math(EXPR pad_len "${pad_len}-${label_len}") if(pad_len LESS "0") - set(pad_len "0") + set(pad_len ${arg_MIN_PADDING}) endif() string(SUBSTRING "${pad_string}" 0 "${pad_len}" pad_string) set(output "${label} ${pad_string} ${value}") -- cgit v1.2.3