CMake: propagate deprecation definitions to unit-tests
If Qt itself is built without the deprecated APIs, but the tests are not, tests will fail to compile and/or link. This patch makes sure that the specified QT_DISABLE_DEPRECATED_UP_TO and QT_WARN_DEPRECATED_UP_TO values are correctly used in the tests. The definitions are propagated to tests, batched tests, manual tests and benchmarks. Fixes: QTBUG-104858 Change-Id: Idf15accaf96c47599084426ba625b985f507ca8b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>bb10
parent
d674f3f545
commit
734e0a2fbe
|
|
@ -33,11 +33,17 @@ function(qt_internal_add_benchmark target)
|
|||
set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
qt_internal_library_deprecation_level(deprecation_define)
|
||||
|
||||
qt_internal_add_executable(${target}
|
||||
NO_INSTALL # we don't install benchmarks
|
||||
OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" # avoid polluting bin directory
|
||||
${exec_args}
|
||||
)
|
||||
qt_internal_extend_target(${target}
|
||||
DEFINES
|
||||
${deprecation_define}
|
||||
)
|
||||
|
||||
# Benchmarks on iOS must be app bundles.
|
||||
if(IOS)
|
||||
|
|
@ -111,11 +117,17 @@ function(qt_internal_add_manual_test target)
|
|||
set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
qt_internal_library_deprecation_level(deprecation_define)
|
||||
|
||||
qt_internal_add_executable(${target}
|
||||
NO_INSTALL # we don't install benchmarks
|
||||
OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" # avoid polluting bin directory
|
||||
${exec_args}
|
||||
)
|
||||
qt_internal_extend_target(${target}
|
||||
DEFINES
|
||||
${deprecation_define}
|
||||
)
|
||||
|
||||
# Tests on iOS must be app bundles.
|
||||
if(IOS)
|
||||
|
|
@ -327,13 +339,17 @@ function(qt_internal_add_test_to_batch batch_name name)
|
|||
list(PREPEND batched_test_list ${name})
|
||||
set_property(GLOBAL PROPERTY _qt_batched_test_list_property ${batched_test_list})
|
||||
|
||||
qt_internal_library_deprecation_level(deprecation_define)
|
||||
|
||||
# Merge the current test with the rest of the batch
|
||||
qt_internal_extend_target(${target}
|
||||
INCLUDE_DIRECTORIES ${arg_INCLUDE_DIRECTORIES}
|
||||
PUBLIC_LIBRARIES ${arg_PUBLIC_LIBRARIES}
|
||||
LIBRARIES ${arg_LIBRARIES}
|
||||
SOURCES ${arg_SOURCES}
|
||||
DEFINES ${arg_DEFINES}
|
||||
DEFINES
|
||||
${arg_DEFINES}
|
||||
${deprecation_define}
|
||||
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
||||
COMPILE_FLAGS ${arg_COMPILE_FLAGS}
|
||||
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
||||
|
|
@ -426,6 +442,8 @@ function(qt_internal_add_test name)
|
|||
list(APPEND private_includes ${arg_INCLUDE_DIRECTORIES})
|
||||
|
||||
qt_internal_prepare_test_target_flags(version_arg exceptions_text gui_text ${ARGN})
|
||||
qt_internal_library_deprecation_level(deprecation_define)
|
||||
|
||||
qt_internal_add_executable("${name}"
|
||||
${exceptions_text}
|
||||
${gui_text}
|
||||
|
|
@ -437,6 +455,7 @@ function(qt_internal_add_test name)
|
|||
${private_includes}
|
||||
DEFINES
|
||||
${arg_DEFINES}
|
||||
${deprecation_define}
|
||||
LIBRARIES
|
||||
${arg_LIBRARIES}
|
||||
${arg_PUBLIC_LIBRARIES}
|
||||
|
|
|
|||
Loading…
Reference in New Issue