summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-19 00:00:07 +0800
committerruki <[email protected]>2021-03-19 00:00:07 +0800
commit35d3d81d6d397907c838698bd3a18ae37b861bc0 (patch)
treef9af81a483d068faa774e4cb50341a30ed5a3f7e
parent60932027d85e9cb499132351b5f080f8d2f572a8 (diff)
fix vs generator
-rw-r--r--xmake/modules/core/tools/cl.lua2
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua24
2 files changed, 21 insertions, 5 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 7b7ef3f9f..110c6f3f5 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -260,7 +260,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return {"-I", path.translate(dir)}
+ return {"-I" .. path.translate(dir)}
end
-- make the sysincludedir flag
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
index b5691a5fa..b1bd6f764 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
@@ -62,7 +62,11 @@ function _make_compcmd(compargv, sourcefile, objectfile, vcxprojdir)
v = v:gsub("__objectfile__", objectfile)
-- -Idir or /Idir
v = v:gsub("([%-/]I)(.*)", function (I, dir)
- dir = path.translate(dir:trim())
+ dir = dir:trim()
+ if #dir == 0 then
+ return ""
+ end
+ dir = path.translate(dir)
if not path.is_absolute(dir) then
dir = path.relative(path.absolute(dir), vcxprojdir)
end
@@ -82,7 +86,11 @@ function _make_compflags(sourcefile, targetinfo, vcxprojdir)
-- -Idir or /Idir
flag = flag:gsub("[%-/]I(.*)", function (dir)
- dir = path.translate(dir:trim())
+ dir = dir:trim()
+ if #dir == 0 then
+ return ""
+ end
+ dir = path.translate(dir)
if not path.is_absolute(dir) then
dir = path.relative(path.absolute(dir), vcxprojdir)
end
@@ -110,7 +118,11 @@ function _make_linkflags(targetinfo, vcxprojdir)
-- replace -libpath:dir or /libpath:dir
flag = flag:gsub(string.ipattern("[%-/]libpath:(.*)"), function (dir)
- dir = path.translate(dir:trim())
+ dir = dir:trim()
+ if #dir == 0 then
+ return ""
+ end
+ dir = path.translate(dir)
if not path.is_absolute(dir) then
dir = path.relative(path.absolute(dir), vcxprojdir)
end
@@ -119,7 +131,11 @@ function _make_linkflags(targetinfo, vcxprojdir)
-- replace -def:dir or /def:dir
flag = flag:gsub(string.ipattern("[%-/]def:(.*)"), function (dir)
- dir = path.translate(dir:trim())
+ dir = dir:trim()
+ if #dir == 0 then
+ return ""
+ end
+ dir = path.translate(dir)
if not path.is_absolute(dir) then
dir = path.relative(path.absolute(dir), vcxprojdir)
end