From 58ccd0f2ee0de904eaabeea5d2d08581e6b2cdbb Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 26 Jul 2017 13:49:41 +0800 Subject: fix check -def: flags --- xmake/actions/config/scanner.lua | 6 +----- xmake/modules/detect/tools/link/has_flags.lua | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/xmake/actions/config/scanner.lua b/xmake/actions/config/scanner.lua index fd363c8df..0776968b5 100644 --- a/xmake/actions/config/scanner.lua +++ b/xmake/actions/config/scanner.lua @@ -135,15 +135,11 @@ function make() file:print(" add_files(\"%s\")", sourcefile) file:print("") - -- add links + -- add deps if #sourcefiles > 0 then file:print(" -- add deps") file:print(" add_deps(\"%s\")", targetname) file:print("") - file:print(" -- add links") - file:print(" add_links(\"%s\")", targetname) - file:print(" add_linkdirs(\"%$(buildir)\")") - file:print("") end end diff --git a/xmake/modules/detect/tools/link/has_flags.lua b/xmake/modules/detect/tools/link/has_flags.lua index 582f6ecf9..d48d2090c 100644 --- a/xmake/modules/detect/tools/link/has_flags.lua +++ b/xmake/modules/detect/tools/link/has_flags.lua @@ -103,6 +103,17 @@ function _check_try_running(flags, opt) return ok end +-- ignore some flags +function _ignore_flags(flags) + local results = {} + for _, flag in ipairs(flags) do + if not flag:find("[%-/]def:.+%.def") then + table.insert(results, flag) + end + end + return results +end + -- has_flags(flags)? -- -- @param opt the argument options, .e.g {toolname = "", program = "", programver = "", toolkind = "[cc|cxx|ld|ar|sh|gc|rc|dc|mm|mxx]"} @@ -111,6 +122,12 @@ end -- function main(flags, opt) + -- ignore some flags + flags = _ignore_flags(flags) + if #flags == 0 then + return true + end + -- attempt to check it from the argument list if _check_from_arglist(flags, opt) then return true -- cgit v1.3.1