summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Leclercq <[email protected]>2021-09-06 13:28:44 +0200
committerSirLynix <[email protected]>2021-09-07 07:49:57 +0200
commit559bbf4128b079988dfa75d7900696949ec27c4a (patch)
tree56296c4274ea9db11226c14ff3188d27e9421c81
parent995920bbfbaaa7336b73cee0eb637ec597f047fd (diff)
Fix cmake debug flags override
Don't use -DCMAKE_C_FLAGS_DEBUG and -DCMAKE_CXX_FLAGS_DEBUG as this will prevent debug flags generation on Windows (suchs as `/MDd /Zi /Ob0 /Od /RTC1`), use CMAKE_C_FLAGS instead
-rw-r--r--xmake/modules/package/tools/cmake.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 857f859be..57318328f 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -133,6 +133,10 @@ function _get_cflags(package, opt)
table.join2(result, opt.cxflags)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
+ local vs_runtime = package:config("vs_runtime")
+ if vs_runtime then
+ table.insert(result, "/" .. vs_runtime)
+ end
if #result > 0 then
return os.args(result)
end
@@ -158,6 +162,10 @@ function _get_cxxflags(package, opt)
table.join2(result, opt.cxflags)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
+ local vs_runtime = package:config("vs_runtime")
+ if vs_runtime then
+ table.insert(result, "/" .. vs_runtime)
+ end
if #result > 0 then
return os.args(result)
end
@@ -271,12 +279,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
@@ -739,4 +741,3 @@ function install(package, configs, opt)
end
os.cd(oldir)
end
-