summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-16 00:05:01 +0800
committerruki <[email protected]>2022-08-16 00:05:01 +0800
commitbc5a02b3f095d1b749a52d26df183f507f69736c (patch)
tree5cf634642f3d37bd2f2e9e30319edc7172d57157
parent170b4ff2ddd796c5ed51643690d6a3a141b9caa7 (diff)
improve std for cmakelists
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua
index 52acbf76f..3ae159b3d 100644
--- a/xmake/plugins/project/cmake/cmakelists.lua
+++ b/xmake/plugins/project/cmake/cmakelists.lua
@@ -577,8 +577,14 @@ function _add_target_languages(cmakelists, target)
local languages = target:get("languages")
if languages then
for _, lang in ipairs(languages) do
+ local has_ext = false
+ if lang:startswith("gnu") then
+ lang = lang:sub(4)
+ has_ext = true
+ end
local feature = features[lang] or (features[lang:replace("++", "xx")])
if feature then
+ cmakelists:print("set_target_properties(%s PROPERTIES CXX_EXTENSIONS %s)", target:name(), has_ext and "ON" or "OFF")
cmakelists:print("target_compile_features(%s PRIVATE %s)", target:name(), feature)
end
end