aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parent1d5e662109b45fdde8b56bf036565cc8d372839d (diff)
Fix library order
Diffstat (limited to 'src')
-rw-r--r--src/CmakeModule.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp
index 27047ba..cdc03eb 100644
--- a/src/CmakeModule.cpp
+++ b/src/CmakeModule.cpp
@@ -42,26 +42,23 @@ namespace sibs
}
#endif
- string staticLinkerFlags;
+ vector<string> linkerFlags;
auto parentProjStaticLinkerFlagCallbackFunc = staticLinkerFlagCallbackFunc;
if (!staticLinkerFlagCallbackFunc || (config.getPackageType() == PackageType::DYNAMIC || config.getPackageType() == PackageType::LIBRARY))
{
- staticLinkerFlagCallbackFunc = [&staticLinkerFlags](const string &linkerFlag)
+ staticLinkerFlagCallbackFunc = [&linkerFlags](const string &linkerFlag)
{
- staticLinkerFlags += " ";
- staticLinkerFlags += linkerFlag;
+ linkerFlags.push_back(linkerFlag);
};
}
- string dynamicLinkerFlags;
auto parentProjDynamicLinkerFlagCallbackFunc = dynamicLinkerFlagCallbackFunc;
// TODO: If project contains no source files, then we shouldn't override this function... why?
if(!dynamicLinkerFlagCallbackFunc || config.getPackageType() != PackageType::STATIC)
{
- dynamicLinkerFlagCallbackFunc = [&dynamicLinkerFlags](const string &linkerFlag)
+ dynamicLinkerFlagCallbackFunc = [&linkerFlags](const string &linkerFlag)
{
- dynamicLinkerFlags += " ";
- dynamicLinkerFlags += linkerFlag;
+ linkerFlags.push_back(linkerFlag);
};
}
@@ -114,7 +111,11 @@ namespace sibs
if(!globalLibResult)
return globalLibResult;
- allLinkerFlags += staticLinkerFlags + dynamicLinkerFlags;
+ for(vector<string>::reverse_iterator it = linkerFlags.rbegin(), end = linkerFlags.rend(); it != end; ++it)
+ {
+ allLinkerFlags += " ";
+ allLinkerFlags += *it;
+ }
Result<bool> createBuildDirResult = createDirectoryRecursive(buildPath.c_str());
if (createBuildDirResult.isErr())