summaryrefslogtreecommitdiffstats
path: root/cmake/QtInternalTargets.cmake
diff options
context:
space:
mode:
authorYuhang Zhao <2546789017@qq.com>2021-11-19 11:05:10 +0800
committerYuhang Zhao <2546789017@qq.com>2021-12-15 13:02:39 +0800
commitd2a0202cdab5827d3e6e25c4d1fcb30afbb12e16 (patch)
tree0472b4397745794e8fe31f26da0c6ed5cb091d7b /cmake/QtInternalTargets.cmake
parent877d6cf6f646cae88aa69c42eaf7ba1780269c87 (diff)
MSVC: Optimize global data to reduce binary size
Package global data in COMDAT sections for optimization. According to the docs, this can significantly reduce the size of the resulting binary executable. I've tested build Qt with /Gw locally with and without LTCG, the result shows /Gw can reduce the binary size indeed, but not "significantly". The result also reveals that exes can benefit much more from /Gw than dlls. The result can be seen from the QTBUG-98894 bug report. Microsoft Docs: https://docs.microsoft.com/en-us/cpp/build/reference/gw-optimize-global-data?view=msvc-170 Task-number: QTBUG-98894 Change-Id: Ibce34c98e791e519d669a5fe39c0027d1459c382 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'cmake/QtInternalTargets.cmake')
-rw-r--r--cmake/QtInternalTargets.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake
index aee33c5dde..fc98e6215d 100644
--- a/cmake/QtInternalTargets.cmake
+++ b/cmake/QtInternalTargets.cmake
@@ -199,7 +199,7 @@ if (MSVC)
target_compile_options(PlatformCommonInternal INTERFACE -Zc:wchar_t)
target_compile_options(PlatformCommonInternal INTERFACE
- $<$<NOT:$<CONFIG:Debug>>:-guard:cf>
+ $<$<NOT:$<CONFIG:Debug>>:-guard:cf -Gw>
)
target_link_options(PlatformCommonInternal INTERFACE