diff options
| author | ruki <[email protected]> | 2017-06-29 17:56:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-29 17:56:38 +0800 |
| commit | cffdbf25772f185bdd86bb08705d0ddfe288bfb9 (patch) | |
| tree | 5a63eeae1285bc385e5ff8e736e7d55c641836dc /xmake | |
| parent | 2f22a73afe79ca3f6728b8e639850b04c7880d03 (diff) | |
improve link has_flag
Diffstat (limited to 'xmake')
| -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 |
