Add qt_internal_undefine_global_definition function
qt_internal_undefine_global_definition disables an internal global definition that is defined by the qt_internal_add_global_definition function for a specific target. Remove the ability to set the custom "undefine" flag for the definitions since it's hard to control it using the introduced function. Pick-to: 6.2 6.3 Task-number: QTBUG-100334 Change-Id: Ic1637d97aa51bbdd06c5b191c57a941aa208d4dc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
1b34ee080e
commit
fd3341a74e
@ -73,10 +73,7 @@ function(qt_internal_set_warnings_are_errors_flags target)
|
||||
endfunction()
|
||||
|
||||
# The function adds a global 'definition' to the platform internal targets and the target
|
||||
# property-based switch to disable the definition. The following command disables the definition for
|
||||
# a specific target:
|
||||
# set_target_properties(<target> PROPERTIES QT_INTERNAL_UNDEF_<definition> TRUE)
|
||||
# where 'QT_INTERNAL_UNDEF_<definition>' might be customized using the UNDEF_PROPERTY_NAME option.
|
||||
# property-based switch to disable the definition.
|
||||
# Arguments:
|
||||
# VALUE optional value that the definition will take.
|
||||
# SCOPE the list of scopes the definition needs to be set for. If the SCOPE is not specified the
|
||||
@ -87,10 +84,9 @@ endfunction()
|
||||
# TOOL - set the definition for all Qt tools
|
||||
# APP - set the definition for all Qt applications
|
||||
# TODO: Add a tests specific platform target and the definition scope for it.
|
||||
# UNDEF_PROPERTY_NAME customizes the name of the target property to avoid adding the definition.
|
||||
function(qt_internal_add_global_definition definition)
|
||||
set(optional_args)
|
||||
set(single_value_args VALUE UNDEF_PROPERTY_NAME)
|
||||
set(single_value_args VALUE)
|
||||
set(multi_value_args SCOPE)
|
||||
cmake_parse_arguments(args
|
||||
"${optional_args}"
|
||||
@ -105,9 +101,6 @@ function(qt_internal_add_global_definition definition)
|
||||
set(scope_APP PlatformAppInternal)
|
||||
|
||||
set(undef_property_name "QT_INTERNAL_UNDEF_${definition}")
|
||||
if(DEFINED arg_UNDEF_PROPERTY_NAME)
|
||||
set(undef_property_name "${arg_UNDEF_PROPERTY_NAME}")
|
||||
endif()
|
||||
|
||||
if(DEFINED arg_VALUE)
|
||||
set(definition "${definition}=${arg_VALUE}")
|
||||
|
@ -857,3 +857,20 @@ function(qt_internal_add_target_include_dirs_and_optionally_propagate target dep
|
||||
|
||||
qt_record_extra_third_party_dependency("${target}" "${dep_target}")
|
||||
endfunction()
|
||||
|
||||
# The function disables one or multiple internal global definitions that are defined by the
|
||||
# qt_internal_add_global_definition function for a specific 'target'.
|
||||
function(qt_internal_undefine_global_definition target)
|
||||
if(NOT TARGET ${target})
|
||||
message(FATAL_ERROR "${target} is not a target.")
|
||||
endif()
|
||||
|
||||
if("${ARGN}" STREQUAL "")
|
||||
message(FATAL_ERROR "The function expects at least one definition as an argument.")
|
||||
endif()
|
||||
|
||||
foreach(definition IN LISTS ARGN)
|
||||
set(undef_property_name "QT_INTERNAL_UNDEF_${definition}")
|
||||
set_target_properties(${target} PROPERTIES "${undef_property_name}" TRUE)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
@ -34,8 +34,7 @@ function(qt_internal_add_benchmark target)
|
||||
)
|
||||
|
||||
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for benchmarks
|
||||
set_target_properties(${target} PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_NARROWING_CONVERSIONS_IN_CONNECT TRUE)
|
||||
qt_internal_undefine_global_definition(${target} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
|
||||
|
||||
qt_internal_collect_command_environment(benchmark_env_path benchmark_env_plugin_path)
|
||||
|
||||
@ -97,8 +96,7 @@ function(qt_internal_add_manual_test target)
|
||||
)
|
||||
|
||||
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for manual tests
|
||||
set_target_properties(${target} PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_NARROWING_CONVERSIONS_IN_CONNECT TRUE)
|
||||
qt_internal_undefine_global_definition(${target} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
|
||||
|
||||
endfunction()
|
||||
|
||||
@ -240,8 +238,7 @@ function(qt_internal_add_test name)
|
||||
)
|
||||
|
||||
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for tests
|
||||
set_target_properties(${name} PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_NARROWING_CONVERSIONS_IN_CONNECT TRUE)
|
||||
qt_internal_undefine_global_definition(${name} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
|
||||
|
||||
# Tests should not be bundles on macOS even if arg_GUI is true, because some tests make
|
||||
# assumptions about the location of helper processes, and those paths would be different
|
||||
@ -631,8 +628,7 @@ function(qt_internal_add_test_helper name)
|
||||
qt_internal_add_executable("${name}" NO_INSTALL ${extra_args_to_pass} ${forward_args})
|
||||
|
||||
# Disable the QT_NO_NARROWING_CONVERSIONS_IN_CONNECT define for test helpers
|
||||
set_target_properties(${name} PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_NARROWING_CONVERSIONS_IN_CONNECT TRUE)
|
||||
qt_internal_undefine_global_definition(${name} QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
@ -16,5 +16,4 @@ qt_internal_extend_target(tst_qfuture CONDITION MSVC
|
||||
/bigobj
|
||||
)
|
||||
|
||||
set_target_properties(tst_qfuture PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_JAVA_STYLE_ITERATORS TRUE)
|
||||
qt_internal_undefine_global_definition(tst_qfuture QT_NO_JAVA_STYLE_ITERATORS)
|
||||
|
@ -9,5 +9,4 @@ qt_internal_add_test(tst_collections
|
||||
tst_collections.cpp
|
||||
)
|
||||
|
||||
set_target_properties(tst_collections PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_JAVA_STYLE_ITERATORS TRUE)
|
||||
qt_internal_undefine_global_definition(tst_collections QT_NO_JAVA_STYLE_ITERATORS)
|
||||
|
@ -9,5 +9,4 @@ qt_internal_add_test(tst_qhash
|
||||
tst_qhash.cpp
|
||||
)
|
||||
|
||||
set_target_properties(tst_qhash PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_JAVA_STYLE_ITERATORS TRUE)
|
||||
qt_internal_undefine_global_definition(tst_qhash QT_NO_JAVA_STYLE_ITERATORS)
|
||||
|
@ -9,5 +9,4 @@ qt_internal_add_test(tst_qmap
|
||||
tst_qmap.cpp
|
||||
)
|
||||
|
||||
set_target_properties(tst_qmap PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_JAVA_STYLE_ITERATORS TRUE)
|
||||
qt_internal_undefine_global_definition(tst_qmap QT_NO_JAVA_STYLE_ITERATORS)
|
||||
|
@ -9,5 +9,4 @@ qt_internal_add_test(tst_qset
|
||||
tst_qset.cpp
|
||||
)
|
||||
|
||||
set_target_properties(tst_qset PROPERTIES
|
||||
QT_INTERNAL_UNDEF_QT_NO_JAVA_STYLE_ITERATORS TRUE)
|
||||
qt_internal_undefine_global_definition(tst_qset QT_NO_JAVA_STYLE_ITERATORS)
|
||||
|
Loading…
Reference in New Issue
Block a user