diff options
| author | ruki <[email protected]> | 2025-01-22 00:35:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-01-22 00:35:31 +0800 |
| commit | 78371cb084abfe3e80e928adae4e55a0df98f34b (patch) | |
| tree | 6ba87b37a28215b93ae98fa448a17341fa3324ed /xmake/rules/c++/xmake.lua | |
| parent | 014838d6d7b370a0825ef320a0df30136d9ea0f1 (diff) | |
improve cmake for ninja
Diffstat (limited to 'xmake/rules/c++/xmake.lua')
| -rw-r--r-- | xmake/rules/c++/xmake.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/rules/c++/xmake.lua b/xmake/rules/c++/xmake.lua index 3723b9d71..94bba431e 100644 --- a/xmake/rules/c++/xmake.lua +++ b/xmake/rules/c++/xmake.lua @@ -23,6 +23,16 @@ rule("c.build") add_deps("c.build.pcheader", "c.build.optimization", "c.build.sanitizer") on_build_files("private.action.build.object", {batch = true, distcc = true}) on_config(function (target) + -- 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 target:has_tool("cc", "cl", "clang_cl") then + if is_mode("debug") then + vs_runtime_default = vs_runtime_default .. "d" + end + target:set("runtimes", vs_runtime_default) + end + end -- https://github.com/xmake-io/xmake/issues/4621 if target:is_plat("windows") and target:is_static() and target:has_tool("cc", "tcc") then target:set("extension", ".a") |
