aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-06-05 15:15:11 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:32 +0200
commit10596d7eb5edb6dbeeedccfd1fa2df81141adda4 (patch)
tree13d7b5a2a085de4e6a05395e6d63d4fec7920c3c /backend
parent1d5e662109b45fdde8b56bf036565cc8d372839d (diff)
Fix library order
Diffstat (limited to 'backend')
-rw-r--r--backend/ninja/Ninja.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index 45fb9cb..ec6a237 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -428,26 +428,24 @@ namespace backend
allLinkerFlags += " ";
allLinkerFlags += binaryDependency;
}
+
+ vector<string> linkerFlags;
- string staticLinkerFlags;
auto parentProjStaticLinkerFlagCallbackFunc = staticLinkerFlagCallbackFunc;
if (!staticLinkerFlagCallbackFunc || libraryType == LibraryType::DYNAMIC)
{
- staticLinkerFlagCallbackFunc = [&staticLinkerFlags](const string &linkerFlag)
+ staticLinkerFlagCallbackFunc = [&linkerFlags](const string &linkerFlag)
{
- staticLinkerFlags += " ";
- staticLinkerFlags += linkerFlag;
+ linkerFlags.push_back(linkerFlag);
};
}
- string dynamicLinkerFlags;
auto parentProjDynamicLinkerFlagCallbackFunc = dynamicLinkerFlagCallback;
if(!dynamicLinkerFlagCallback || libraryType != LibraryType::STATIC)
{
- dynamicLinkerFlagCallback = [&dynamicLinkerFlags](const string &linkerFlag)
+ dynamicLinkerFlagCallback = [&linkerFlags](const string &linkerFlag)
{
- dynamicLinkerFlags += " ";
- dynamicLinkerFlags += linkerFlag;
+ linkerFlags.push_back(linkerFlag);
};
}
@@ -462,11 +460,15 @@ namespace backend
if(!buildSubProjectResult)
return buildSubProjectResult;
- Result<bool> linkerFlags = getLinkerFlags(config, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallback, globalIncludeDirCallback, cflagsCallbackFunc);
- if (linkerFlags.isErr())
- return Result<bool>::Err(linkerFlags.getErrMsg());
+ Result<bool> linkerFlagsResult = getLinkerFlags(config, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallback, globalIncludeDirCallback, cflagsCallbackFunc);
+ if (linkerFlagsResult.isErr())
+ return Result<bool>::Err(linkerFlagsResult.getErrMsg());
- allLinkerFlags += staticLinkerFlags + dynamicLinkerFlags;
+ for(vector<string>::reverse_iterator it = linkerFlags.rbegin(), end = linkerFlags.rend(); it != end; ++it)
+ {
+ allLinkerFlags += " ";
+ allLinkerFlags += *it;
+ }
result += dependencyExportIncludeDirs;
result += "\n\n";