diff options
| author | ruki <[email protected]> | 2024-09-16 23:52:37 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-09-16 23:52:37 +0800 |
| commit | 647b1efa1d3646ed0e753e3b41d0fa3486313e63 (patch) | |
| tree | a35c8b6e630275c333d1d3b6f8d2556620b8a3a0 | |
| parent | b61bb48dd89bfa135cdcf7399add04ee04c05267 (diff) | |
fix runtime
| -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 |
