From aea68d4513ca678d9a1fe73b8230be7450e60e4a Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 26 Jul 2022 22:30:54 +0800 Subject: improve vs runtime for cmake --- xmake/plugins/project/cmake/cmakelists.lua | 17 +++++++++++------ 1 file 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$<$:Debug>" - elseif vs_runtime:startswith("MD") then - vs_runtime = "MultiThreaded$<$:Debug>DLL" end cmakelists:print(' set_property(TARGET %s PROPERTY', target:name()) cmakelists:print(' MSVC_RUNTIME_LIBRARY "%s")', vs_runtime) -- cgit v1.3.1