summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-07-22 22:30:30 +0800
committerGitHub <[email protected]>2023-07-22 22:30:30 +0800
commit85c280aa5b3d9614f5f3c2ee54d930cc66f15ea5 (patch)
tree7e8133ece56ce06f0d2cd89514c1ad4dd3767b2d
parent56bc58325b10e39b8278e81e1852997334716efb (diff)
parentedc54d1e8b046780e032934a5462783298ec93ea (diff)
Merge pull request #3995 from RimuruChan/patch-1
fix: none exception for cmake
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua22
1 files 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