aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/ninja/Ninja.cpp18
-rw-r--r--src/CmakeModule.cpp17
2 files changed, 22 insertions, 13 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index 044fb64..fb081de 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -411,23 +411,25 @@ namespace backend
allLinkerFlags += " ";
allLinkerFlags += binaryDependency;
}
-
+
+ string staticLinkerFlags;
if (!staticLinkerFlagCallbackFunc || libraryType == LibraryType::DYNAMIC)
{
- staticLinkerFlagCallbackFunc = [&allLinkerFlags](const string &linkerFlag)
+ staticLinkerFlagCallbackFunc = [&staticLinkerFlags](const string &linkerFlag)
{
- allLinkerFlags += " ";
- allLinkerFlags += linkerFlag;
+ staticLinkerFlags += " ";
+ staticLinkerFlags += linkerFlag;
};
}
+ string dynamicLinkerFlags;
// TODO: Do same for cmake
if (!sourceFiles.empty())
{
- dynamicLinkerFlagCallback = [&allLinkerFlags](const string &linkerFlag)
+ dynamicLinkerFlagCallback = [&dynamicLinkerFlags](const string &linkerFlag)
{
- allLinkerFlags += " ";
- allLinkerFlags += linkerFlag;
+ dynamicLinkerFlags += " ";
+ dynamicLinkerFlags += linkerFlag;
};
}
@@ -441,6 +443,8 @@ namespace backend
Result<bool> linkerFlags = getLinkerFlags(config, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallback, globalIncludeDirCallback, cflagsCallbackFunc);
if (linkerFlags.isErr())
return Result<bool>::Err(linkerFlags.getErrMsg());
+
+ allLinkerFlags += staticLinkerFlags + dynamicLinkerFlags;
result += dependencyExportIncludeDirs;
result += "\n\n";
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp
index 35e4884..990bf36 100644
--- a/src/CmakeModule.cpp
+++ b/src/CmakeModule.cpp
@@ -41,20 +41,23 @@ namespace sibs
allLinkerFlags += binaryDependency;
}
#endif
+
+ string staticLinkerFlags;
if (!staticLinkerFlagCallbackFunc || (config.getPackageType() == PackageType::DYNAMIC || config.getPackageType() == PackageType::LIBRARY))
{
- staticLinkerFlagCallbackFunc = [&allLinkerFlags](const string &linkerFlag)
+ staticLinkerFlagCallbackFunc = [&staticLinkerFlags](const string &linkerFlag)
{
- allLinkerFlags += " ";
- allLinkerFlags += linkerFlag;
+ staticLinkerFlags += " ";
+ staticLinkerFlags += linkerFlag;
};
}
+ string dynamicLinkerFlags;
// TODO: If project contains no source files, then we shouldn't override this function
- dynamicLinkerFlagCallbackFunc = [&allLinkerFlags](const string &linkerFlag)
+ dynamicLinkerFlagCallbackFunc = [&dynamicLinkerFlags](const string &linkerFlag)
{
- allLinkerFlags += " ";
- allLinkerFlags += linkerFlag;
+ dynamicLinkerFlags += " ";
+ dynamicLinkerFlags += linkerFlag;
};
// TODO: Create a cmake module that contains library/include path for the dependencies (https://cmake.org/Wiki/CMake:How_To_Find_Libraries).
@@ -105,6 +108,8 @@ namespace sibs
Result<bool> globalLibResult = GlobalLib::getLibs(globalLibDependencies, config, globalLibDir, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
if(!globalLibResult)
return globalLibResult;
+
+ allLinkerFlags += staticLinkerFlags + dynamicLinkerFlags;
Result<bool> createBuildDirResult = createDirectoryRecursive(buildPath.c_str());
if (createBuildDirResult.isErr())