summaryrefslogtreecommitdiff
path: root/xmake/languages/objc++/check_main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-01-06 21:02:59 +0800
committerruki <[email protected]>2017-01-06 21:02:59 +0800
commit8ebf3589c0981ef078a817e246f45d549406034a (patch)
tree4851b351291b5b710d6b0c2b6ce4640a27a1553c /xmake/languages/objc++/check_main.lua
parentb898bfaaa35568bf911204dde5239de9fe6e062f (diff)
improve to check main
Diffstat (limited to 'xmake/languages/objc++/check_main.lua')
-rw-r--r--xmake/languages/objc++/check_main.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/languages/objc++/check_main.lua b/xmake/languages/objc++/check_main.lua
index 462ad4c6c..87a2002ae 100644
--- a/xmake/languages/objc++/check_main.lua
+++ b/xmake/languages/objc++/check_main.lua
@@ -27,8 +27,12 @@ function main(sourcefile)
-- load source code
local sourcecode = io.read(sourcefile)
+ -- remove comment first
+ sourcecode = sourcecode:gsub("/%*.-%*/", "")
+ sourcecode = sourcecode:gsub("//.-\n", "\n")
+
-- find int main(int argc, char** argv) {}
- if sourcecode:find("%s+main%s*%(.*%)") then
+ if sourcecode:find("%s+main%s*%(.-%)") then
return true
end