CMake: Move separate debug info handling to an executable finalizer
Currently the separate debug info handling is done inside the call of qt_internal_add_executable. But there might be extra properties set after the executable is created, which we might want to consider when handling the separate debug info, like whether the executable is a macOS bundle. Introduce a new qt_internal_finalize_executable finalizer. Move the separate debug info handler to be called in this finalizer. To be consistent run the separate debug info handler in a finalizer for qt tools as well. Pick-to: 6.8 Change-Id: I46412249aaab099628a50b11efff541f5719aff5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
59039f42d8
commit
aa06c8dbfa
@ -242,9 +242,13 @@ function(qt_internal_add_executable name)
|
||||
else()
|
||||
unset(separate_debug_info_executable_arg)
|
||||
endif()
|
||||
qt_enable_separate_debug_info(${name} "${arg_INSTALL_DIRECTORY}"
|
||||
${separate_debug_info_executable_arg}
|
||||
ADDITIONAL_INSTALL_ARGS ${additional_install_args})
|
||||
|
||||
qt_internal_defer_separate_debug_info("${name}"
|
||||
SEPARATE_DEBUG_INFO_ARGS
|
||||
"${arg_INSTALL_DIRECTORY}"
|
||||
${separate_debug_info_executable_arg}
|
||||
ADDITIONAL_INSTALL_ARGS ${additional_install_args}
|
||||
)
|
||||
qt_internal_install_pdb_files(${name} "${arg_INSTALL_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
@ -264,6 +268,13 @@ function(qt_internal_add_executable name)
|
||||
|
||||
_qt_internal_extend_sbom(${name} ${sbom_args})
|
||||
endif()
|
||||
|
||||
qt_add_list_file_finalizer(qt_internal_finalize_executable "${name}")
|
||||
endfunction()
|
||||
|
||||
# Finalizer for all generic internal executables.
|
||||
function(qt_internal_finalize_executable target)
|
||||
qt_internal_finalize_executable_separate_debug_info("${target}")
|
||||
endfunction()
|
||||
|
||||
# This function compiles the target at configure time the very first time and creates the custom
|
||||
|
@ -75,6 +75,9 @@ function(qt_watch_current_list_dir variable access value current_list_file stack
|
||||
qt_finalize_module(${a1} ${a2} ${a3} ${a4} ${a5} ${a6} ${a7} ${a8} ${a9})
|
||||
elseif(func STREQUAL "qt_finalize_plugin")
|
||||
qt_finalize_plugin(${a1} ${a2} ${a3} ${a4} ${a5} ${a6} ${a7} ${a8} ${a9})
|
||||
elseif(func STREQUAL "qt_internal_finalize_executable")
|
||||
qt_internal_finalize_executable(
|
||||
${a1} ${a2} ${a3} ${a4} ${a5} ${a6} ${a7} ${a8} ${a9})
|
||||
elseif(func STREQUAL "qt_internal_finalize_app")
|
||||
qt_internal_finalize_app(${a1} ${a2} ${a3} ${a4} ${a5} ${a6} ${a7} ${a8} ${a9})
|
||||
elseif(func STREQUAL "qt_internal_finalize_tool")
|
||||
|
@ -66,6 +66,37 @@ function(qt_internal_try_compile_binary_for_strip binary_out_var)
|
||||
set(${binary_out_var} "${output_binary_path}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Helper to defer calling the separate debug info helper args until the finalizer is run.
|
||||
function(qt_internal_defer_separate_debug_info target)
|
||||
set(opt_args "")
|
||||
set(single_args "")
|
||||
set(multi_args
|
||||
SEPARATE_DEBUG_INFO_ARGS
|
||||
)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
|
||||
_qt_internal_validate_all_args_are_parsed(arg)
|
||||
|
||||
set_property(TARGET "${target}" PROPERTY _qt_finalize_separate_debug_info_enabled TRUE)
|
||||
set_property(TARGET "${target}" APPEND PROPERTY _qt_finalize_separate_debug_info_args
|
||||
${arg_SEPARATE_DEBUG_INFO_ARGS}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# Handler to run the separate debug info helper using finalizer args.
|
||||
function(qt_internal_finalize_executable_separate_debug_info target)
|
||||
get_target_property(enabled "${target}" _qt_finalize_separate_debug_info_enabled)
|
||||
if(NOT enabled)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(args "${target}" _qt_finalize_separate_debug_info_args)
|
||||
if(NOT args)
|
||||
set(args "")
|
||||
endif()
|
||||
|
||||
qt_enable_separate_debug_info("${target}" ${args})
|
||||
endfunction()
|
||||
|
||||
# When using the MinGW 11.2.0 toolchain, cmake --install --strip as used by
|
||||
# qt-cmake-private-install.cmake, removes the .gnu_debuglink section in binaries and thus
|
||||
# breaks the separate debug info feature.
|
||||
|
@ -283,7 +283,11 @@ function(qt_internal_add_tool target_name)
|
||||
_qt_internal_add_try_run_post_build("${target_name}" "${arg_TRY_RUN_FLAGS}")
|
||||
endif()
|
||||
|
||||
qt_enable_separate_debug_info(${target_name} "${install_dir}" QT_EXECUTABLE)
|
||||
qt_internal_defer_separate_debug_info("${target_name}"
|
||||
SEPARATE_DEBUG_INFO_ARGS
|
||||
"${install_dir}"
|
||||
QT_EXECUTABLE
|
||||
)
|
||||
qt_internal_install_pdb_files(${target_name} "${install_dir}")
|
||||
|
||||
if(QT_GENERATE_SBOM)
|
||||
|
Loading…
x
Reference in New Issue
Block a user