diff options
| author | ruki <[email protected]> | 2020-10-07 23:55:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-07 23:55:22 +0800 |
| commit | c15ba078768e3b3f591b1aab71ead1c91858aee0 (patch) | |
| tree | cf3e09c4675464d85765a6759ccc78a0ac558ddf | |
| parent | 9593868eec9d4ec509d81933f406c64c7a422903 (diff) | |
improve find_ar
| -rw-r--r-- | xmake/modules/detect/tools/find_ar.lua | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/xmake/modules/detect/tools/find_ar.lua b/xmake/modules/detect/tools/find_ar.lua index b5622302c..d33b40448 100644 --- a/xmake/modules/detect/tools/find_ar.lua +++ b/xmake/modules/detect/tools/find_ar.lua @@ -19,27 +19,21 @@ -- -- imports -import("core.tool.compiler") import("lib.detect.find_program") -- check function _check(program) - -- make an stub source file - local libraryfile = os.tmpfile() .. ".a" - local objectfile = os.tmpfile() .. ".o" - local sourcefile = os.tmpfile() .. ".c" - io.writefile(sourcefile, "int test(void)\n{return 0;}") - - -- compile it - compiler.compile(sourcefile, objectfile) + -- make a stub object file + local libraryfile = os.tmpfile() .. ".a" + local objectfile = os.tmpfile() .. ".o" + io.writefile(objectfile, "") -- archive it os.runv(program, {"-cr", libraryfile, objectfile}) -- remove files os.rm(objectfile) - os.rm(sourcefile) os.rm(libraryfile) end |
