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 <alexandru.croitor@qt.io>
This commit is contained in:
parent
a3b9e3459f
commit
30a9b045cc
@ -140,13 +140,32 @@ macro(qt_configure_add_report_padded label message)
|
|||||||
set(__qt_configure_reports "${__qt_configure_reports}" PARENT_SCOPE)
|
set(__qt_configure_reports "${__qt_configure_reports}" PARENT_SCOPE)
|
||||||
endmacro()
|
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)
|
function(qt_configure_get_padded_string label value out_var)
|
||||||
|
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 ".........................................")
|
set(pad_string ".........................................")
|
||||||
|
endif()
|
||||||
string(LENGTH "${label}" label_len)
|
string(LENGTH "${label}" label_len)
|
||||||
string(LENGTH "${pad_string}" pad_len)
|
string(LENGTH "${pad_string}" pad_len)
|
||||||
math(EXPR pad_len "${pad_len}-${label_len}")
|
math(EXPR pad_len "${pad_len}-${label_len}")
|
||||||
if(pad_len LESS "0")
|
if(pad_len LESS "0")
|
||||||
set(pad_len "0")
|
set(pad_len ${arg_MIN_PADDING})
|
||||||
endif()
|
endif()
|
||||||
string(SUBSTRING "${pad_string}" 0 "${pad_len}" pad_string)
|
string(SUBSTRING "${pad_string}" 0 "${pad_len}" pad_string)
|
||||||
set(output "${label} ${pad_string} ${value}")
|
set(output "${label} ${pad_string} ${value}")
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
# TOP_LEVEL: TRUE, if this is a top-level build.
|
# TOP_LEVEL: TRUE, if this is a top-level build.
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/QtFeatureCommon.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/QtFeatureCommon.cmake)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/QtBuildInformation.cmake)
|
||||||
|
|
||||||
cmake_policy(SET CMP0007 NEW)
|
cmake_policy(SET CMP0007 NEW)
|
||||||
cmake_policy(SET CMP0057 NEW)
|
cmake_policy(SET CMP0057 NEW)
|
||||||
@ -60,6 +61,8 @@ while(configure_args)
|
|||||||
set(auto_detect_generator FALSE)
|
set(auto_detect_generator FALSE)
|
||||||
elseif(arg STREQUAL "-no-guess-compiler")
|
elseif(arg STREQUAL "-no-guess-compiler")
|
||||||
set(auto_detect_compiler FALSE)
|
set(auto_detect_compiler FALSE)
|
||||||
|
elseif(arg STREQUAL "-list-features")
|
||||||
|
set(list_features TRUE)
|
||||||
elseif(arg STREQUAL "-skip")
|
elseif(arg STREQUAL "-skip")
|
||||||
list(POP_FRONT configure_args qtrepo)
|
list(POP_FRONT configure_args qtrepo)
|
||||||
push("-DBUILD_${qtrepo}=OFF")
|
push("-DBUILD_${qtrepo}=OFF")
|
||||||
@ -94,7 +97,10 @@ endwhile()
|
|||||||
set_property(GLOBAL PROPERTY COMMANDLINE_KNOWN_FEATURES "")
|
set_property(GLOBAL PROPERTY COMMANDLINE_KNOWN_FEATURES "")
|
||||||
|
|
||||||
function(qt_feature feature)
|
function(qt_feature feature)
|
||||||
|
cmake_parse_arguments(arg "" "PURPOSE;SECTION;" "" ${ARGN})
|
||||||
set_property(GLOBAL APPEND PROPERTY COMMANDLINE_KNOWN_FEATURES "${feature}")
|
set_property(GLOBAL APPEND PROPERTY COMMANDLINE_KNOWN_FEATURES "${feature}")
|
||||||
|
set_property(GLOBAL PROPERTY COMMANDLINE_FEATURE_PURPOSE_${feature} "${arg_PURPOSE}")
|
||||||
|
set_property(GLOBAL PROPERTY COMMANDLINE_FEATURE_SECTION_${feature} "${arg_SECTION}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
macro(defstub name)
|
macro(defstub name)
|
||||||
@ -405,6 +411,26 @@ function(qt_call_function func)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if(list_features)
|
||||||
|
unset(lines)
|
||||||
|
foreach(feature ${commandline_known_features})
|
||||||
|
get_property(section GLOBAL PROPERTY COMMANDLINE_FEATURE_SECTION_${feature})
|
||||||
|
get_property(purpose GLOBAL PROPERTY COMMANDLINE_FEATURE_PURPOSE_${feature})
|
||||||
|
if(purpose)
|
||||||
|
if(NOT "${section}" STREQUAL "")
|
||||||
|
string(APPEND section ": ")
|
||||||
|
endif()
|
||||||
|
qt_configure_get_padded_string("${feature}" "${section}${purpose}" line
|
||||||
|
PADDING_LENGTH 25 MIN_PADDING 1)
|
||||||
|
list(APPEND lines "${line}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
list(SORT lines)
|
||||||
|
list(JOIN lines "\n" lines)
|
||||||
|
message("${lines}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
qtConfHasNextCommandlineArg(has_next)
|
qtConfHasNextCommandlineArg(has_next)
|
||||||
if(NOT has_next)
|
if(NOT has_next)
|
||||||
|
@ -48,6 +48,8 @@ Configure meta:
|
|||||||
|
|
||||||
-feature-<feature> ... Enable <feature>
|
-feature-<feature> ... Enable <feature>
|
||||||
-no-feature-<feature> Disable <feature> [none]
|
-no-feature-<feature> Disable <feature> [none]
|
||||||
|
-list-features ....... List available features. Note that some features
|
||||||
|
have dedicated command line options as well.
|
||||||
|
|
||||||
Build options:
|
Build options:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user