summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/package/tools/cmake.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 92d6d7e72..7aaf64b7d 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -116,6 +116,11 @@ function _get_cflags(package, opt)
table.join2(result, opt.cxflags)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
+ for i, flag in ipairs(result) do
+ if flag:match(" ") then
+ result[i] = '"' .. flag .. '"'
+ end
+ end
if #result > 0 then
return table.concat(result, ' ')
end
@@ -141,6 +146,11 @@ function _get_cxxflags(package, opt)
table.join2(result, opt.cxflags)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
+ for i, flag in ipairs(result) do
+ if flag:match(" ") then
+ result[i] = '"' .. flag .. '"'
+ end
+ end
if #result > 0 then
return table.concat(result, ' ')
end
@@ -160,6 +170,11 @@ function _get_asflags(package, opt)
if opt.asflags then
table.join2(result, opt.asflags)
end
+ for i, flag in ipairs(result) do
+ if flag:match(" ") then
+ result[i] = '"' .. flag .. '"'
+ end
+ end
if #result > 0 then
return table.concat(result, ' ')
end
@@ -179,6 +194,11 @@ function _get_ldflags(package, opt)
if opt.ldflags then
table.join2(result, opt.ldflags)
end
+ for i, flag in ipairs(result) do
+ if flag:match(" ") then
+ result[i] = '"' .. flag .. '"'
+ end
+ end
if #result > 0 then
return table.concat(result, ' ')
end
@@ -198,6 +218,11 @@ function _get_shflags(package, opt)
if opt.shflags then
table.join2(result, opt.shflags)
end
+ for i, flag in ipairs(result) do
+ if flag:match(" ") then
+ result[i] = '"' .. flag .. '"'
+ end
+ end
if #result > 0 then
return table.concat(result, ' ')
end