improve package.tools.cmake
@@ -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
