summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/cl.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-08-17 23:58:49 +0800
committerruki <[email protected]>2018-08-17 17:52:59 +0800
commit56278d4967d2b40f28b23f7c84da7550db31b830 (patch)
tree90d080b45b00659ee277eb32a1efbe9fc343d430 /xmake/modules/core/tools/cl.lua
parent3f5a45a8d1f5d96acc4b28c9b33b4bf0c1f43665 (diff)
support c++ std keys
Diffstat (limited to 'xmake/modules/core/tools/cl.lua')
-rw-r--r--xmake/modules/core/tools/cl.lua51
1 files changed, 30 insertions, 21 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 4b3eaa8ad..bedf7e2e9 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -179,32 +179,41 @@ end
function nf_language(self, stdname)
-- the stdc maps
- local cmaps =
- {
- -- stdc
- c99 = "-TP" -- compile as c++ files because msvc only support c89
- , gnu99 = "-TP"
- , c11 = "-TP"
- , gnu11 = "-TP"
- }
+ if _g.cmaps == nil then
+ _g.cmaps =
+ {
+ -- stdc
+ c99 = "-TP" -- compile as c++ files because msvc only support c89
+ , gnu99 = "-TP"
+ , c11 = "-TP"
+ , gnu11 = "-TP"
+ }
+ end
-- the stdc++ maps
- local cxxmaps =
- {
- cxx11 = "-std:c++11"
- , gnuxx11 = "-std:c++11"
- , cxx14 = "-std:c++14"
- , gnuxx14 = "-std:c++14"
- , cxx17 = "-std:c++17"
- , gnuxx17 = "-std:c++17"
- , cxx1z = "-std:c++latest"
- , gnuxx1z = "-std:c++latest"
- }
+ if _g.cxxmaps == nil then
+ _g.cxxmaps =
+ {
+ cxx11 = "-std:c++11"
+ , gnuxx11 = "-std:c++11"
+ , cxx14 = "-std:c++14"
+ , gnuxx14 = "-std:c++14"
+ , cxx17 = "-std:c++17"
+ , gnuxx17 = "-std:c++17"
+ , cxx1z = "-std:c++latest"
+ , gnuxx1z = "-std:c++latest"
+ }
+ local cxxmaps2 = {}
+ for k, v in pairs(_g.cxxmaps) do
+ cxxmaps2[k:gsub("xx", "++")] = v
+ end
+ table.join2(_g.cxxmaps, cxxmaps2)
+ end
-- select maps
- local maps = cmaps
+ local maps = _g.cmaps
if self:kind() == "cxx" or self:kind() == "mxx" then
- maps = cxxmaps
+ maps = _g.cxxmaps
end
-- map it