diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2017-12-21 16:03:18 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2018-01-24 14:10:10 (GMT) |
commit | 044831117955dfa33ed4e0c7799ea3f37258b149 (patch) | |
tree | a443e5f1695bc9290ac7a8c27e4d0df019146a8d /Source/cmLocalGenerator.cxx | |
parent | 3073bd1f3deecaaf090202075382e372a3b3656a (diff) | |
download | CMake-044831117955dfa33ed4e0c7799ea3f37258b149.zip CMake-044831117955dfa33ed4e0c7799ea3f37258b149.tar.gz CMake-044831117955dfa33ed4e0c7799ea3f37258b149.tar.bz2 |
sourceFile properties: add property INCLUDE_DIRECTORIES
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d918cf3..86b16f8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -16,6 +16,7 @@ #include "cmMakefile.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" +#include "cmSourceFileLocation.h" #include "cmState.h" #include "cmStateDirectory.h" #include "cmStateTypes.h" @@ -37,6 +38,7 @@ #include <sstream> #include <stdio.h> #include <string.h> +#include <unordered_set> #include <utility> #if defined(__HAIKU__) @@ -1959,6 +1961,52 @@ void cmLocalGenerator::AppendCompileOptions( } } +void cmLocalGenerator::AppendIncludeDirectories( + std::vector<std::string>& includes, const char* includes_list, + const cmSourceFile& sourceFile) const +{ + // Short-circuit if there are no includes. + if (!includes_list) { + return; + } + + // Expand the list of includes. + std::vector<std::string> includes_vec; + cmSystemTools::ExpandListArgument(includes_list, includes_vec); + this->AppendIncludeDirectories(includes, includes_vec, sourceFile); +} + +void cmLocalGenerator::AppendIncludeDirectories( + std::vector<std::string>& includes, + const std::vector<std::string>& includes_vec, + const cmSourceFile& sourceFile) const +{ + std::unordered_set<std::string> uniqueIncludes; + + for (const std::string& include : includes_vec) { + if (!cmSystemTools::FileIsFullPath(include.c_str())) { + std::ostringstream e; + e << "Found relative path while evaluating include directories of " + "\"" + << sourceFile.GetLocation().GetName() << "\":\n \"" << include + << "\"\n"; + + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } + + std::string inc = include; + + if (!cmSystemTools::IsOff(inc.c_str())) { + cmSystemTools::ConvertToUnixSlashes(inc); + } + + if (uniqueIncludes.insert(inc).second) { + includes.push_back(inc); + } + } +} + void cmLocalGenerator::AppendDefines(std::set<std::string>& defines, const char* defines_list) const { |