summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtExecutableHelpers.cmake17
-rw-r--r--cmake/QtScopeFinalizerHelpers.cmake3
-rw-r--r--cmake/QtSeparateDebugInfo.cmake31
-rw-r--r--cmake/QtToolHelpers.cmake6
4 files changed, 53 insertions, 4 deletions
diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake
index 05b3603e048..4c96c811e96 100644
--- a/cmake/QtExecutableHelpers.cmake
+++ b/cmake/QtExecutableHelpers.cmake
@@ -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
diff --git a/cmake/QtScopeFinalizerHelpers.cmake b/cmake/QtScopeFinalizerHelpers.cmake
index 6d3961dc7cd..fd86e3cfac9 100644
--- a/cmake/QtScopeFinalizerHelpers.cmake
+++ b/cmake/QtScopeFinalizerHelpers.cmake
@@ -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")
diff --git a/cmake/QtSeparateDebugInfo.cmake b/cmake/QtSeparateDebugInfo.cmake
index 61f62207fab..dff64937f17 100644
--- a/cmake/QtSeparateDebugInfo.cmake
+++ b/cmake/QtSeparateDebugInfo.cmake
@@ -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.
diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake
index a90779d9706..3b53b94d1f9 100644
--- a/cmake/QtToolHelpers.cmake
+++ b/cmake/QtToolHelpers.cmake
@@ -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)