diff options
| author | ruki <[email protected]> | 2020-11-26 22:43:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-26 22:43:51 +0800 |
| commit | 6426a1e2f0dea74ee3d82abe9f8b7aa46ed9ef9f (patch) | |
| tree | 93343f3997f689c048f2af4d8d373c33dfb0e86c /xmake/modules/lib/detect/has_flags.lua | |
| parent | c9c4a0046f6ec2f0f2f4699e49d8809629a055f2 (diff) | |
improve to check sourceDependencies for cl
Diffstat (limited to 'xmake/modules/lib/detect/has_flags.lua')
| -rw-r--r-- | xmake/modules/lib/detect/has_flags.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua index d041819f8..1401a6306 100644 --- a/xmake/modules/lib/detect/has_flags.lua +++ b/xmake/modules/lib/detect/has_flags.lua @@ -29,7 +29,7 @@ import("lib.detect.find_tool") -- -- @param name the tool name -- @param flags the flags --- @param opt the argument options, e.g. { verbose = false, program = "", sysflags = {}, flagkind = "cxflag", toolkind = "[cc|cxx|ld|ar|sh|gc|rc|dc|mm|mxx]", flagskey = "custom key" } +-- @param opt the argument options, e.g. {force = true, verbose = false, program = "", sysflags = {}, flagkind = "cxflag", toolkind = "[cc|cxx|ld|ar|sh|gc|rc|dc|mm|mxx]", flagskey = "custom key" } -- -- @return true or false -- @@ -37,6 +37,7 @@ import("lib.detect.find_tool") -- local ok = has_flags("clang", "-g") -- local ok = has_flags("clang", {"-g", "-O0"}, {program = "xcrun -sdk macosx clang"}) -- local ok = has_flags("clang", "-g", {toolkind = "cxx"}) +-- local ok = has_flags("clang", "-g", {on_check = function (ok, errors) return ok, errors end}) -- @endcode -- function main(name, flags, opt) @@ -85,7 +86,7 @@ function main(name, flags, opt) -- attempt to get result from cache first local cacheinfo = cache.load("lib.detect.has_flags") local result = cacheinfo[key] - if result ~= nil then + if result ~= nil and not opt.force then return result end @@ -115,6 +116,9 @@ function main(name, flags, opt) else result = try { function () os.runv(tool.program, checkflags, {envs = opt.envs}); return true end, catch { function (errs) errors = errs end }} end + if opt.on_check then + result, errors = opt.on_check(result, errors) + end _g._checking = nil result = result or false @@ -134,8 +138,6 @@ function main(name, flags, opt) -- save result to cache cacheinfo[key] = result cache.save("lib.detect.has_flags", cacheinfo) - - -- ok? return result end |
