diff options
| -rw-r--r-- | xmake/core/project/policy.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/c++/xmake.lua | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index 9390d336e..dcef4c421 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -85,7 +85,7 @@ function policy.policies() -- Force C++ modules fallback dependency scanner for msvc ["build.c++.msvc.fallbackscanner"] = {description = "Force msvc fallback module dependency scanner.", default = false, type = "boolean"}, -- Set the default vs runtime, e.g. MT, MD - ["build.c++.msvc.runtime"] = {description = "Set the default vs runtime.", default = "MT", type = "string", values = {"MT", "MD"}}, + ["build.c++.msvc.runtime"] = {description = "Set the default vs runtime.", type = "string", values = {"MT", "MD"}}, -- Force C++ modules fallback dependency scanner for gcc ["build.c++.gcc.fallbackscanner"] = {description = "Force gcc fallback module dependency scanner.", default = false, type = "boolean"}, -- Force to enable new cxx11 abi in C++ modules for gcc diff --git a/xmake/rules/c++/xmake.lua b/xmake/rules/c++/xmake.lua index 432d37855..3723b9d71 100644 --- a/xmake/rules/c++/xmake.lua +++ b/xmake/rules/c++/xmake.lua @@ -42,12 +42,11 @@ rule("c++.build") -- enable vs runtime as MD by default if target:is_plat("windows") and not target:get("runtimes") then local vs_runtime_default = target:policy("build.c++.msvc.runtime") - if vs_runtime_default and vs_runtime_default == "MD" and target:has_tool("cxx", "cl", "clang_cl") then + if vs_runtime_default and target:has_tool("cxx", "cl", "clang_cl") then if is_mode("debug") then - target:set("runtimes", "MDd") - else - target:set("runtimes", "MD") + vs_runtime_default = vs_runtime_default .. "d" end + target:set("runtimes", vs_runtime_default) end end -- https://github.com/xmake-io/xmake/issues/4621 |
