From 1f8c6d3560607078cf33a396f1907bb1677ba234 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 22 Feb 2023 12:40:57 +0200 Subject: CMake: Enable exception handling on MSVC Sample warning: Building CXX object src\shared\qbs\src\shared\json\CMakeFiles\qbsjson.dir\json.cpp.obj C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(378): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(371): note: while compiling class template member function 'std::basic_ostream> &std::basic_ostream>::operator <<(unsigned __int64)' F:\Projects\qt-creator\qt-creator\src\shared\qbs\src\shared\json\json.cpp(4142): note: see reference to function template instantiation 'std::basic_ostream> &std::basic_ostream>::operator <<(unsigned __int64)' being compiled C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(671): note: see reference to class template instantiation 'std::basic_ostream>' being compiled Change-Id: I404cdeb5e447fe880998aaec4c576c0ed6dd3507 Reviewed-by: Ivan Komissarov --- cmake/QbsBuildConfig.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/QbsBuildConfig.cmake b/cmake/QbsBuildConfig.cmake index f70a1c53c..4e49cf4b3 100644 --- a/cmake/QbsBuildConfig.cmake +++ b/cmake/QbsBuildConfig.cmake @@ -175,6 +175,9 @@ function(add_qbs_library target_name) RUNTIME DESTINATION ${QBS_DLL_INSTALL_DIR} ) endif() + if(MSVC) + target_compile_options(${target_name} PUBLIC /EHsc) + endif() endfunction() function(add_qbs_plugin target_name) -- cgit v1.2.3