summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-07 16:43:20 +0800
committerGitHub <[email protected]>2021-09-07 16:43:20 +0800
commit7313e0dae040ed0cff6cad8ca934649721cb46da (patch)
tree8f25f5a4aab9b69916d73d19e0dc4bb5f32fe6fa
parent42a7aaffe4d274b86945194462cbd61636ee39a4 (diff)
parent9201e1c987a85dc2c80cc007ad2b8fb1c43562ab (diff)
Merge pull request #1645 from SirLynix/patch-6
Fix cmake debug flags override
-rw-r--r--xmake/modules/package/tools/cmake.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 40a1ad2e5..c13b48356 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -133,6 +133,12 @@ function _get_cflags(package, opt)
table.join2(result, opt.cxflags)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
+ if package:is_plat("windows") then
+ local vs_runtime = package:config("vs_runtime")
+ if vs_runtime then
+ table.insert(result, "/" .. vs_runtime)
+ end
+ end
if #result > 0 then
return os.args(result)
end
@@ -158,6 +164,12 @@ function _get_cxxflags(package, opt)
table.join2(result, opt.cxflags)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
+ if package:is_plat("windows") then
+ local vs_runtime = package:config("vs_runtime")
+ if vs_runtime then
+ table.insert(result, "/" .. vs_runtime)
+ end
+ end
if #result > 0 then
return os.args(result)
end
@@ -271,12 +283,6 @@ function _get_configs_for_windows(package, configs, opt)
elseif vs_runtime == "MDd" then
table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL")
end
- if vs_runtime then
- table.insert(configs, '-DCMAKE_CXX_FLAGS_DEBUG="/' .. vs_runtime .. '"')
- table.insert(configs, '-DCMAKE_CXX_FLAGS_RELEASE="/' .. vs_runtime .. '"')
- table.insert(configs, '-DCMAKE_C_FLAGS_DEBUG="/' .. vs_runtime .. '"')
- table.insert(configs, '-DCMAKE_C_FLAGS_RELEASE="/' .. vs_runtime .. '"')
- end
_get_configs_for_generic(package, configs, opt)
end
@@ -766,4 +772,3 @@ function install(package, configs, opt)
end
os.cd(oldir)
end
-