diff options
author | Liam Devine <dmail00@gmail.com> | 2011-03-26 03:21:44 +0300 |
---|---|---|
committer | Liam Devine <dmail00@gmail.com> | 2011-03-26 03:21:44 +0300 |
commit | 0926bb12c8a8bab752960aef157b42fba5a0556f (patch) | |
tree | 2e0db14699bedd6a6caab86763ac1eee7d1d0dab /src/tools | |
parent | 6d4fb88a2551ab2be223ddc724a2961556a8c15c (diff) |
* Patch 3043933 gmake incorrectly links using -l when a solution contains a .so and .a of the same name and the static lib is wanted (Jonathan Derque)
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/gcc.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index 1f5fc74..771cd17 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -174,7 +174,23 @@ function premake.gcc.getlinkflags(cfg) local result = { } - for _, value in ipairs(premake.getlinks(cfg, "all", "basename")) do + for _, value in ipairs(premake.getlinks(cfg, "dependencies", "object")) do + -- don't use "-llib" arguments when linking static libraries + if (value.kind == "StaticLib") then + local pathstyle = premake.getpathstyle(value) + local namestyle = premake.getnamestyle(value) + local linktarget = premake.gettarget(value, "link", pathstyle, namestyle, cfg.system) + table.insert(result, linktarget.fullpath) + else + if path.getextension(value.basename) == ".framework" then + table.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value.basename))) + else + table.insert(result, '-l' .. _MAKE.esc(value.basename)) + end + end + end + -- "-llib" is fine for system dependencies + for _, value in ipairs(premake.getlinks(cfg, "system", "basename")) do if path.getextension(value) == ".framework" then table.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value))) else |