diff options
| author | ruki <[email protected]> | 2017-11-16 23:10:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-11-16 13:04:23 +0800 |
| commit | a28ddd8d5eab9f60ada2c3d8013de0f1c79abec1 (patch) | |
| tree | eabbe9dfd6e7163346e9ec70b6dd9f6545689566 | |
| parent | 94dae341a83418d8cd35cb5279bc66fc711ab0ad (diff) | |
improve fPIC for mingw/gcc
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 205921400..2c4a5a0a3 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -41,11 +41,17 @@ function init(self) , "-DIBAction=void)__attribute__((ibaction)"} -- init shflags - _g.shflags = { "-shared", "-fPIC" } + _g.shflags = { "-shared" } -- init cxflags for the kind: shared _g.shared = {} - _g.shared.cxflags = {"-fPIC"} + _g.shared.cxflags = {} + + -- add -fPIC (need not it on mingw/windows) + if self:has_flags("-fPIC") then + table.insert(_g.shflags, "-fPIC") + table.insert(_g.shared.cxflags, "-fPIC") + end -- suppress warning for clang (gcc -> clang on macosx) if self:has_flags("-Qunused-arguments") then |
