diff options
author | Yuhang Zhao <2546789017@qq.com> | 2022-11-22 15:22:30 +0800 |
---|---|---|
committer | Yuhang Zhao <2546789017@qq.com> | 2022-12-03 12:55:20 +0800 |
commit | 0d708a9aad8fa7f44e94f5bc9093a6c93d6140b1 (patch) | |
tree | ccac08da553521013fc28b66f754545d718aacf8 /cmake | |
parent | 58861f78c0822f74744a3285abeb785219b8f96c (diff) | |
download | qtbase-0d708a9aad8fa7f44e94f5bc9093a6c93d6140b1.tar.gz |
MSVC: Improve the LTCG build
When we use MSVC to build static libraries, enabling LTCG will
generate very large output, for example, Qt's bundled 3rd party
libraries can be greater than 100MB per file (some of them even >200MB!).
This is not good if we are building a shared version of Qt and
enabling LTCG at the same time. On Windows Qt's bundled 3rd party
dependencies will be built as static libraries and they will make
the final Qt package way too large. From my side, if I only build
a release version, the package size is usually around 500MB but
when LTCG is enabled, it become over 2GB. The exe and dlls' size
don't vary much, but there are many large static libraries.
Fixes: QTBUG-108719
Change-Id: Ic521f500b9c24389524e96a8cdc2e7b3427b51a9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Qt3rdPartyLibraryHelpers.cmake | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmake/Qt3rdPartyLibraryHelpers.cmake b/cmake/Qt3rdPartyLibraryHelpers.cmake index 1bec4db6b9..220bcaf157 100644 --- a/cmake/Qt3rdPartyLibraryHelpers.cmake +++ b/cmake/Qt3rdPartyLibraryHelpers.cmake @@ -310,6 +310,12 @@ function(qt_internal_add_3rdparty_library target) qt_enable_separate_debug_info(${target} "${debug_install_dir}") qt_internal_install_pdb_files(${target} "${INSTALL_LIBDIR}") endif() + + if(BUILD_SHARED_LIBS AND MSVC) + set_target_properties(${target} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION OFF + ) + endif() endfunction() function(qt_install_3rdparty_library_wrap_config_extra_file target) |