From 88406f446c1ee1ae3e015379fff04df804535f93 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Sat, 7 Oct 2023 14:03:03 +0800 Subject: [PATCH] cmake: add some note of MSVC undocumented flag I added this flag but only explained what it is in the original commit message, it may confuse future code readers without some inline comments. So add some comments to avoid such issue. Change-Id: I6a3c0f53c2bc58646cc70e45cacb1d0e40656c0a Reviewed-by: Thiago Macieira --- cmake/QtFlagHandlingHelpers.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake index f93aaef841..168b67463b 100644 --- a/cmake/QtFlagHandlingHelpers.cmake +++ b/cmake/QtFlagHandlingHelpers.cmake @@ -250,6 +250,10 @@ function(qt_internal_set_exceptions_flags target exceptions_on) if(MSVC) set(_flag "/EHsc") if((MSVC_VERSION GREATER_EQUAL 1929) AND NOT CLANG) + # Use the undocumented compiler flag to make our binary smaller on x64. + # https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/ + # NOTE: It seems we'll use this new exception handling model unconditionally without + # this hack since some unknown MSVC version. set(_flag ${_flag} "/d2FH4") endif() endif()