configure: Convert -feature-* arguments to -DFEATURE_foo CMake args
We now convert the configure arguments -feature-foo and -no-feature-foo to the CMake arguments -DFEATURE_foo=ON and -DFEATURE_foo=OFF. This is done, because the former behavior was surprising, and it allows us to remove quite some code that was needed to calculate feature values from INPUT_foo and FEATURE_foo. Task-number: QTBUG-120529 Change-Id: I94f8eb4adbbcaa1090aedce6e711012781c62a3c Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
38de2c9532
commit
faa06fc6f5
@ -85,6 +85,7 @@ list(TRANSFORM configure_args STRIP)
|
|||||||
unset(generator)
|
unset(generator)
|
||||||
set(auto_detect_compiler TRUE)
|
set(auto_detect_compiler TRUE)
|
||||||
set(auto_detect_generator ${qtbase_or_top_level_build})
|
set(auto_detect_generator ${qtbase_or_top_level_build})
|
||||||
|
set(no_prefix_option FALSE)
|
||||||
unset(device_options)
|
unset(device_options)
|
||||||
unset(options_json_file)
|
unset(options_json_file)
|
||||||
set_property(GLOBAL PROPERTY UNHANDLED_ARGS "")
|
set_property(GLOBAL PROPERTY UNHANDLED_ARGS "")
|
||||||
@ -127,8 +128,10 @@ while(NOT "${configure_args}" STREQUAL "")
|
|||||||
push("-DINSTALL_MKSPECSDIR=${path}")
|
push("-DINSTALL_MKSPECSDIR=${path}")
|
||||||
elseif(arg STREQUAL "-developer-build")
|
elseif(arg STREQUAL "-developer-build")
|
||||||
set(developer_build TRUE)
|
set(developer_build TRUE)
|
||||||
# Treat this argument as "unhandled" to process it further.
|
push("-DFEATURE_developer_build=ON")
|
||||||
set_property(GLOBAL APPEND PROPERTY UNHANDLED_ARGS "${arg}")
|
elseif(arg STREQUAL "-no-prefix")
|
||||||
|
set(no_prefix_option TRUE)
|
||||||
|
push("-DFEATURE_no_prefix=ON")
|
||||||
elseif(arg STREQUAL "-cmake-file-api")
|
elseif(arg STREQUAL "-cmake-file-api")
|
||||||
set(cmake_file_api TRUE)
|
set(cmake_file_api TRUE)
|
||||||
elseif(arg STREQUAL "-no-cmake-file-api")
|
elseif(arg STREQUAL "-no-cmake-file-api")
|
||||||
@ -664,10 +667,20 @@ while(1)
|
|||||||
if(arg MATCHES "^--?enable-(.*)")
|
if(arg MATCHES "^--?enable-(.*)")
|
||||||
set(opt "${CMAKE_MATCH_1}")
|
set(opt "${CMAKE_MATCH_1}")
|
||||||
set(val "yes")
|
set(val "yes")
|
||||||
# Handle -no-prefix so it's not interpreted as the negation of -prefix
|
# Handle builtin [-no]-feature-xxx
|
||||||
elseif(arg MATCHES "-(no-prefix)")
|
elseif(arg MATCHES "^--?(no-)?feature-(.*)")
|
||||||
set(opt "${CMAKE_MATCH_1}")
|
set(opt "${CMAKE_MATCH_2}")
|
||||||
set(val "")
|
if(NOT opt IN_LIST commandline_known_features)
|
||||||
|
qtConfAddError("Enabling/Disabling unknown feature '${opt}'.")
|
||||||
|
endif()
|
||||||
|
if("${CMAKE_MATCH_1}" STREQUAL "")
|
||||||
|
set(val "ON")
|
||||||
|
else()
|
||||||
|
set(val "OFF")
|
||||||
|
endif()
|
||||||
|
qt_feature_normalize_name("${opt}" normalized_feature_name)
|
||||||
|
push(-DFEATURE_${normalized_feature_name}=${val})
|
||||||
|
continue()
|
||||||
elseif(arg MATCHES "^--?(disable|no)-(.*)")
|
elseif(arg MATCHES "^--?(disable|no)-(.*)")
|
||||||
set(opt "${CMAKE_MATCH_2}")
|
set(opt "${CMAKE_MATCH_2}")
|
||||||
set(val "no")
|
set(val "no")
|
||||||
@ -704,15 +717,6 @@ while(1)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Handle builtin [-no]-feature-xxx
|
|
||||||
if("${type}" STREQUAL "" AND opt MATCHES "^feature-(.*)")
|
|
||||||
set(opt "${CMAKE_MATCH_1}")
|
|
||||||
if(NOT opt IN_LIST commandline_known_features)
|
|
||||||
qtConfAddError("Enabling/Disabling unknown feature '${opt}'.")
|
|
||||||
endif()
|
|
||||||
set(type boolean)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if("${type}" STREQUAL "")
|
if("${type}" STREQUAL "")
|
||||||
qtConfAddError("Unknown command line option '${arg}'.")
|
qtConfAddError("Unknown command line option '${arg}'.")
|
||||||
endif()
|
endif()
|
||||||
@ -995,7 +999,7 @@ foreach(input ${config_inputs})
|
|||||||
push("-DINPUT_${cmake_input}=${INPUT_${input}}")
|
push("-DINPUT_${cmake_input}=${INPUT_${input}}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(DEFINED INPUT_no-prefix AND DEFINED INPUT_prefix)
|
if(no_prefix_option AND DEFINED INPUT_prefix)
|
||||||
qtConfAddError("Can't specify both -prefix and -no-prefix options at the same time.")
|
qtConfAddError("Can't specify both -prefix and -no-prefix options at the same time.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user