From cb202af580fed1f3bccc8f0a3b3c8c89a9f26443 Mon Sep 17 00:00:00 2001 From: xpxz <97490782+heheda123123@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:47:32 +0800 Subject: Update cmakelists.lua Distinguish the different parameters for handling exceptions between clang and gcc --- xmake/plugins/project/cmake/cmakelists.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index fd0f6ff2c..fea241066 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -620,6 +620,13 @@ end -- add target exceptions function _add_target_exceptions(cmakelists, target) local flags_gcc = + { + cxx = "-fexceptions", + ["no-cxx"] = "-fno-exceptions", + objc = "-fobjc-exceptions", + ["no-objc"] = "-fno-objc-exceptions" + } + local flags_clang = { cxx = "-fcxx-exceptions", ["no-cxx"] = "-fno-cxx-exceptions", @@ -641,6 +648,10 @@ function _add_target_exceptions(cmakelists, target) for _, exception in ipairs(exceptions) do cmakelists:print(" target_compile_options(%s PRIVATE %s)", target:name(), flags_msvc[exception]) end + cmakelists:print("elseif(Clang)") + for _, exception in ipairs(exceptions) do + cmakelists:print(" target_compile_options(%s PRIVATE %s)", target:name(), flags_clang[exception]) + end cmakelists:print("else()") for _, exception in ipairs(exceptions) do cmakelists:print(" target_compile_options(%s PRIVATE %s)", target:name(), flags_gcc[exception]) -- cgit v1.3.1