From 169141eaa2158281f80aca5c30e17c9d1ace52d7 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 29 Sep 2021 00:45:56 +0800 Subject: improve vs runtime for cmake generator again --- xmake/plugins/project/cmake/cmakelists.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 7d8765055..ba1689cb1 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -383,16 +383,13 @@ function _add_target_vs_runtime(cmakelists, target) local vs_runtime = target:get("runtimes") if vs_runtime then cmakelists:print("if(MSVC)") - 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" + if vs_runtime:startswith("MT") then + vs_runtime = "MultiThreaded$<$:Debug>" + elseif vs_runtime:startswith("MD") then + vs_runtime = "MultiThreaded$<$:Debug>DLL" end - cmakelists:print(' set_property(TARGET %s PROPERTY MSVC_RUNTIME_LIBRARY "%s")', target:name(), vs_runtime) + cmakelists:print(' set_property(TARGET %s PROPERTY', target:name()) + cmakelists:print(' MSVC_RUNTIME_LIBRARY "%s")', vs_runtime) cmakelists:print("endif()") end end -- cgit v1.3.1