diff options
-rw-r--r-- | backend/ninja/Ninja.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index dda4aa4..d9b4eed 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -39,6 +39,14 @@ namespace backend return result; } + bool endsWith(const string &str, const string &endWithStr) + { + if(endWithStr.size() > str.size()) + return false; + else + return strncmp(&str[str.size() - endWithStr.size()], &endWithStr[0], endWithStr.size()) == 0; + } + Ninja::LibraryType getNinjaLibraryType(PackageType packageType) { switch(packageType) @@ -315,6 +323,9 @@ namespace backend objectNames.reserve(sourceFiles.size()); for(const string &sourceFile : sourceFiles) { + string sourceFileLanguage = "c++"; + if(endsWith(sourceFile, ".c")) + sourceFileLanguage = "c"; //string sourceFileEncoded = sourceFile; //replace(sourceFileEncoded, '/', '@'); string objectName = config.getPackageName() + "@exe/" + sourceFile + ".o"; |