summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-26 22:30:54 +0800
committerruki <[email protected]>2022-07-26 22:30:54 +0800
commitaea68d4513ca678d9a1fe73b8230be7450e60e4a (patch)
tree9e4b629a226acca5fb8aabace5d793c6440bafd7
parent2a9dee4e72b32f3beab1c483e77e7b85a0b827c0 (diff)
improve vs runtime for cmake
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua
index 062a9bad0..09feb78e3 100644
--- a/xmake/plugins/project/cmake/cmakelists.lua
+++ b/xmake/plugins/project/cmake/cmakelists.lua
@@ -594,14 +594,19 @@ function _add_target_vs_runtime(cmakelists, target)
local cmake_minver = _get_cmake_minver()
if cmake_minver:ge("3.15.0") then
local vs_runtime = target:get("runtimes")
- if not vs_runtime then
- vs_runtime = "MT"
- end
cmakelists:print("if(MSVC)")
- if vs_runtime:startswith("MT") then
+ if vs_runtime then
+ if vs_runtime == "MT" then
+ vs_runtime = "MultiThreaded"
+ elseif vs_runtime == "MTd" then
+ vs_runtime = "MultiThreadedDebug"
+ elseif vs_runtime == "MD" then
+ vs_runtime = "MultiThreadedDLL"
+ elseif vs_runtime == "MDd" then
+ vs_runtime = "MultiThreadedDebugDLL"
+ end
+ else
vs_runtime = "MultiThreaded$<$<CONFIG:Debug>:Debug>"
- elseif vs_runtime:startswith("MD") then
- vs_runtime = "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
end
cmakelists:print(' set_property(TARGET %s PROPERTY', target:name())
cmakelists:print(' MSVC_RUNTIME_LIBRARY "%s")', vs_runtime)