diff options
| author | ruki <[email protected]> | 2015-06-11 14:11:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-11 14:12:05 +0800 |
| commit | f5b089a2170c000d4c0781eb08d6545894b14ab9 (patch) | |
| tree | d4538abc9f5d2e54439ca11ab76cfd33bc5259cf /xmake/scripts/base/compiler.lua | |
| parent | 2680c6575a238d0a199f2a31fcf47cd6d0687b62 (diff) | |
fix checking option bug for windows
Diffstat (limited to 'xmake/scripts/base/compiler.lua')
| -rw-r--r-- | xmake/scripts/base/compiler.lua | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/xmake/scripts/base/compiler.lua b/xmake/scripts/base/compiler.lua index 8120bd037..65daf8afb 100644 --- a/xmake/scripts/base/compiler.lua +++ b/xmake/scripts/base/compiler.lua @@ -280,14 +280,16 @@ end function compiler.check_include(opt, include, srcpath, objpath) -- check - assert(opt and include and srcpath and objpath) + assert(opt and srcpath and objpath) -- open the checking source file local srcfile = io.open(srcpath, "w") if not srcfile then return end -- make include - srcfile:write(string.format("#include <%s>\n\n", include)) + if include then + srcfile:write(string.format("#include <%s>\n\n", include)) + end -- make the main function header srcfile:write("int main(int argc, char** argv)\n") @@ -344,11 +346,8 @@ function compiler.check_include(opt, include, srcpath, objpath) local cmd = string.format("%s > %s 2>&1", c.command_compile(srcpath, objpath, table.concat(flags, " "):trim()), xmake._NULDEV) if not cmd then return end - -- check it - if 0 ~= os.execute(cmd) then return end - - -- ok - return true + -- execute the compile command + return c.main(cmd) end -- check function for the project option @@ -433,11 +432,8 @@ function compiler.check_function(opt, interface, srcpath, objpath) local cmd = string.format("%s > %s 2>&1", c.command_compile(srcpath, objpath, table.concat(flags, " "):trim()), xmake._NULDEV) if not cmd then return end - -- check it - if 0 ~= os.execute(cmd) then return end - - -- ok - return true + -- execute the compile command + return c.main(cmd) end -- return module: compiler |
