From edc54d1e8b046780e032934a5462783298ec93ea Mon Sep 17 00:00:00 2001 From: RimuruChan <42002296+RimuruChan@users.noreply.github.com> Date: Sat, 22 Jul 2023 15:53:09 +0800 Subject: fix: none exception for cmake --- xmake/plugins/project/cmake/cmakelists.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 6b62ebe8a..0c78ba4bf 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -679,16 +679,20 @@ function _add_target_exceptions(cmakelists, target) } local exceptions = target:get("exceptions") if exceptions then - cmakelists:print("if(MSVC)") - -- msvc or clang-cl - for _, exception in ipairs(exceptions) do - cmakelists:print(" target_compile_options(%s PRIVATE %s)", target:name(), flags_msvc[exception]) - end - cmakelists:print("else()") - for _, exception in ipairs(exceptions) do - cmakelists:print(" target_compile_options(%s PRIVATE %s)", target:name(), flags_gcc[exception]) + if exceptions == "none" then + cmakelists:print("string(REPLACE \"/EHsc\" \"\" CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS}\")") + else + cmakelists:print("if(MSVC)") + -- msvc or clang-cl + for _, exception in ipairs(exceptions) do + cmakelists:print(" target_compile_options(%s PRIVATE %s)", target:name(), flags_msvc[exception]) + end + cmakelists:print("else()") + for _, exception in ipairs(exceptions) do + cmakelists:print(" target_compile_options(%s PRIVATE %s)", target:name(), flags_gcc[exception]) + end + cmakelists:print("endif()") end - cmakelists:print("endif()") end end -- cgit v1.3.1