diff options
| -rw-r--r-- | xmake/modules/core/tools/lib.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_lib.lua | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/xmake/modules/core/tools/lib.lua b/xmake/modules/core/tools/lib.lua index 704fe406c..6c07e9d1f 100644 --- a/xmake/modules/core/tools/lib.lua +++ b/xmake/modules/core/tools/lib.lua @@ -28,7 +28,7 @@ function extract(self, libraryfile, objectdir) os.mkdir(objectdir) -- list object files - local objectfiles = vstool.iorunv(self:program(), {"-nologo", "-list", libraryfile}) + local objectfiles = vstool.iorunv(self:program(), {"-nologo", "-list", libraryfile}, {envs = self:runenvs()}) -- extrace all object files for _, objectfile in ipairs(objectfiles:split('\n')) do @@ -50,7 +50,7 @@ function extract(self, libraryfile, objectdir) end -- extract it - vstool.runv(self:program(), {"-nologo", "-extract:" .. objectfile, "-out:" .. outputfile, libraryfile}) + vstool.runv(self:program(), {"-nologo", "-extract:" .. objectfile, "-out:" .. outputfile, libraryfile}, {envs = self:runenvs()}) end end end diff --git a/xmake/modules/detect/tools/find_lib.lua b/xmake/modules/detect/tools/find_lib.lua index 2b65c978b..653dca5bb 100644 --- a/xmake/modules/detect/tools/find_lib.lua +++ b/xmake/modules/detect/tools/find_lib.lua @@ -21,6 +21,7 @@ -- imports import("lib.detect.find_program") import("lib.detect.find_programver") +import("lib.detect.find_tool") -- find lib -- @@ -50,8 +51,10 @@ function main(opt) io.writefile(sourcefile, "int test(void)\n{return 0;}") -- check it - os.runv("cl", {"-c", "-Fo" .. objectfile, sourcefile}, {envs = opt.envs}) - os.runv("link", {"-lib", "-out:" .. libraryfile, objectfile}, {envs = opt.envs}) + local cl = assert(find_tool("cl")) + local link = assert(find_tool("link")) + os.runv(cl.program, {"-c", "-Fo" .. objectfile, sourcefile}, {envs = opt.envs}) + os.runv(link.program, {"-lib", "-out:" .. libraryfile, objectfile}, {envs = opt.envs}) verinfo = os.iorunv(program, {"-list", libraryfile}, {envs = opt.envs}) -- remove files |
