summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-10-20 13:16:07 +0800
committerruki <[email protected]>2016-10-20 13:16:07 +0800
commit380a6bd6bbd7e8d3f9bbfc9461c145793fd90d10 (patch)
tree1cbce41a4cc5bcab8782ea6b36c038e89f88a370
parent5c98f1edc2f521fd882d1796bdb043492ce138fe (diff)
fix options order for linking
-rwxr-xr-xxmake/actions/config/configheader.lua2
-rw-r--r--xmake/core/project/target.lua4
-rw-r--r--xmake/core/tool/compiler.lua2
-rw-r--r--xmake/core/tool/linker.lua2
4 files changed, 6 insertions, 4 deletions
diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua
index 4497b37f4..3a261e556 100755
--- a/xmake/actions/config/configheader.lua
+++ b/xmake/actions/config/configheader.lua
@@ -67,7 +67,7 @@ function _make_for_target(files, target)
local undefines = table.copy(target:get("undefines_h"))
-- make the options
- for name, opt in pairs(target:options()) do
+ for _, opt in ipairs(target:options()) do
-- get the option defines
table.join2(defines, opt:get("defines_h_if_ok"))
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 34b11b67c..361286cff 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -75,7 +75,9 @@ function target:options()
local opt = nil
if config.get(name) then opt = option.load(name) end
if nil ~= opt then
- options[name] = opt
+
+ -- insert it and must ensure the order for linking
+ table.insert(options, opt)
end
end
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 81c6c5da8..00c50ea3f 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -168,7 +168,7 @@ function compiler:_addflags_from_target(flags, target)
if target.options then
-- add the flags for the target options
- for _, opt in pairs(target:options()) do
+ for _, opt in ipairs(target:options()) do
-- add the flags from the option
self:_addflags_from_target(flags, opt)
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index c4bbd767a..19430f908 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -148,7 +148,7 @@ function linker:_addflags_from_target(flags, target)
if target.options then
-- add the flags for the target options
- for _, opt in pairs(target:options()) do
+ for _, opt in ipairs(target:options()) do
-- add the flags from the option
table.join2(flags, self:_mapflags(opt:get(self:_flagname())))