diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2023-06-28 15:36:02 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2023-06-29 18:49:45 +0200 |
commit | 49ce711796c2f10dfe658cc77b81db1f2d1b25f7 (patch) | |
tree | 9f9875726db88dcae9fcc5f8498bb1448cb14db3 /src/tools | |
parent | ed1fbc7a88008ddf118556a97f1ee34989151c75 (diff) |
Fix syncqt compiler and linker flags handling
We want syncqt to be built optimized by default. The current approach
set the default build type for the external projects and optimized
flags for the non-configure-time syncqt build. The problem is that
syncqt still have compiler flags littered by either the Qt configuration
type or the system defaults that are applicable for RelWithDebugInfo
configuration(the default one we chose for syncqt).
This patch makes sure that we cleanup all compiler flags from any
optimizations and apply optimized flags for all configurations. Also
we discard '/RTC1' flag if it's set. Configure time executables now
respect the language related flags that are set in the project and
adjust the flags passed to try_compile.
For linker flags we should use those that are applicable for the
preferred build type. Since syncqt is built in RelWithDebugInfo
by default we should replace linker flags in all configs with
those are used for RelWithDebugInfo configuration.
Fixes: QTBUG-114925
Pick-to: 6.5 6.6
Change-Id: I782f81a36f5ef7ee4d342ce8ac6c217cb2552f3b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/syncqt/CMakeLists.txt | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tools/syncqt/CMakeLists.txt b/src/tools/syncqt/CMakeLists.txt index 4d2cb640f0..b23d5836ef 100644 --- a/src/tools/syncqt/CMakeLists.txt +++ b/src/tools/syncqt/CMakeLists.txt @@ -1,6 +1,17 @@ -# The tool should be optimized for maximum performance when working. -if(NOT QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS) +if(NOT QT_INTERNAL_AVOID_OVERRIDING_SYNCQT_CONFIG) + qt_internal_get_configs_for_flag_manipulation(configs) + qt_internal_remove_known_optimization_flags(LANGUAGES CXX CONFIGS ${configs}) + # The /RTC1 flag is present in the default DEBUG flags list and contradicts -O2 but is not + # removed by qt_internal_remove_known_optimization_flags + qt_internal_remove_compiler_flags("/RTC1" LANGUAGES CXX CONFIGS ${configs}) qt_internal_get_optimize_full_flags(optimize_full_flags) + qt_internal_add_compiler_flags(LANGUAGES CXX CONFIGS ${configs} FLAGS "${optimize_full_flags}") + + # Replace all linker flags with those we use in the RelWithDebInfo configuration + list(REMOVE_ITEM configs RELWITHDEBINFO) + foreach(config IN LISTS configs) + set(CMAKE_EXE_LINKER_FLAGS_${config} "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}") + endforeach() endif() set(compile_definitions @@ -15,7 +26,6 @@ qt_get_tool_target_name(target_name syncqt) if(NOT QT_SYNC_HEADERS_AT_CONFIGURE_TIME) qt_internal_add_tool(${target_name} DEFINES ${compile_definitions} - COMPILE_OPTIONS ${optimize_full_flags} TOOLS_TARGET Core CORE_LIBRARY None INSTALL_DIR "${INSTALL_LIBEXECDIR}" @@ -39,7 +49,6 @@ else() # To re-build syncqt use 'syncqt_build' target. qt_internal_add_configure_time_tool(${target_name} DEFINES ${compile_definitions} - COMPILE_OPTIONS ${optimize_full_flags} TOOLS_TARGET Core INSTALL_DIRECTORY "${INSTALL_LIBEXECDIR}" CMAKE_FLAGS |