diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CmakeModule.cpp | 19 |
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()) |