2022-07-05 11:26:52 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2022-08-19 13:21:34 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2022-07-05 11:26:52 +00:00
|
|
|
|
2021-05-19 17:46:24 +00:00
|
|
|
# Helper to check if the finalizer mode should be used.
|
2021-06-17 15:55:42 +00:00
|
|
|
# If true, use finalizer mode.
|
2021-05-19 17:46:24 +00:00
|
|
|
# If false, use regular mode (usage requirement propagation via associated Qt module)
|
2021-06-17 15:55:42 +00:00
|
|
|
# Arguments:
|
|
|
|
# DEFAULT_VALUE specifies the default value of the finalizer mode flag if it is not set.
|
2021-05-19 17:46:24 +00:00
|
|
|
function(__qt_internal_check_finalizer_mode target out_var finalizer)
|
2021-06-17 15:55:42 +00:00
|
|
|
set(option_args "")
|
|
|
|
set(single_args DEFAULT_VALUE)
|
|
|
|
set(multi_args "")
|
|
|
|
cmake_parse_arguments(arg "${option_args}" "${single_args}" "${multi_args}" ${ARGN})
|
|
|
|
|
|
|
|
if(NOT DEFINED arg_DEFAULT_VALUE OR arg_DEFAULT_VALUE)
|
|
|
|
set(arg_DEFAULT_VALUE TRUE)
|
|
|
|
else()
|
|
|
|
set(arg_DEFAULT_VALUE FALSE)
|
|
|
|
endif()
|
2021-05-19 17:46:24 +00:00
|
|
|
get_target_property(value ${target} _qt_${finalizer}_finalizer_mode)
|
|
|
|
if("${value}" STREQUAL "value-NOTFOUND")
|
2021-06-17 15:55:42 +00:00
|
|
|
__qt_internal_enable_finalizer_mode(${target} ${finalizer} "${arg_DEFAULT_VALUE}")
|
|
|
|
set(value "${arg_DEFAULT_VALUE}")
|
2021-05-19 17:46:24 +00:00
|
|
|
endif()
|
|
|
|
set(${out_var} "${value}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(__qt_internal_enable_finalizer_mode target finalizer enabled)
|
|
|
|
if(enabled)
|
|
|
|
set(enabled "TRUE")
|
|
|
|
else()
|
|
|
|
set(enabled "FALSE")
|
|
|
|
endif()
|
|
|
|
set_property(TARGET "${target}" PROPERTY _qt_${finalizer}_finalizer_mode "${enabled}")
|
|
|
|
endfunction()
|