diff options
| -rw-r--r-- | xmake/modules/detect/tools/link/has_flag.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/xmake/modules/detect/tools/link/has_flag.lua b/xmake/modules/detect/tools/link/has_flag.lua index e46647f99..008f28912 100644 --- a/xmake/modules/detect/tools/link/has_flag.lua +++ b/xmake/modules/detect/tools/link/has_flag.lua @@ -71,9 +71,14 @@ end function _check_try_running(flag, opt) -- make an stub source file - local sourcefile = path.join(os.tmpdir(), "detect", "link_has_flag.c") + local winmain = flag:lower():find("subsystem:windows") + local sourcefile = path.join(os.tmpdir(), "detect", ifelse(winmain, "winmain_", "") .. "link_has_flag.c") if not os.isfile(sourcefile) then - io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}") + if winmain then + io.writefile(sourcefile, "int WinMain(void* instance, void* previnst, char** argv, int argc)\n{return 0;}") + else + io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}") + end end -- compile the source file |
