aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
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";