summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraSublimeTextGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@sap.com>2017-12-21 16:03:18 (GMT)
committerMarc Chevrier <marc.chevrier@sap.com>2018-01-24 14:10:10 (GMT)
commit044831117955dfa33ed4e0c7799ea3f37258b149 (patch)
treea443e5f1695bc9290ac7a8c27e4d0df019146a8d /Source/cmExtraSublimeTextGenerator.cxx
parent3073bd1f3deecaaf090202075382e372a3b3656a (diff)
downloadCMake-044831117955dfa33ed4e0c7799ea3f37258b149.zip
CMake-044831117955dfa33ed4e0c7799ea3f37258b149.tar.gz
CMake-044831117955dfa33ed4e0c7799ea3f37258b149.tar.bz2
sourceFile properties: add property INCLUDE_DIRECTORIES
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx42
1 files changed, 32 insertions, 10 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 7e998c7..a89c187 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -257,6 +257,8 @@ void cmExtraSublimeTextGenerator::AppendTarget(
std::string flagsString =
this->ComputeFlagsForObject(sourceFile, lg, target);
std::string definesString = this->ComputeDefines(sourceFile, lg, target);
+ std::string includesString =
+ this->ComputeIncludes(sourceFile, lg, target);
flags.clear();
cmsys::RegularExpression flagRegex;
// Regular expression to extract compiler flags from a string
@@ -264,7 +266,8 @@ void cmExtraSublimeTextGenerator::AppendTarget(
const char* regexString =
"(^|[ ])-[DIOUWfgs][^= ]+(=\\\"[^\"]+\\\"|=[^\"][^ ]+)?";
flagRegex.compile(regexString);
- std::string workString = flagsString + " " + definesString;
+ std::string workString =
+ flagsString + " " + definesString + " " + includesString;
while (flagRegex.find(workString)) {
std::string::size_type start = flagRegex.start();
if (workString[start] == ' ') {
@@ -351,15 +354,6 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
lg->GetTargetCompileFlags(gtgt, config, language, flags);
- // Add include directory flags.
- {
- std::vector<std::string> includes;
- lg->GetIncludeDirectories(includes, gtgt, language, config);
- std::string includeFlags = lg->GetIncludeFlags(includes, gtgt, language,
- true); // full include paths
- lg->AppendFlags(flags, includeFlags);
- }
-
// Add source file specific flags.
cmGeneratorExpressionInterpreter genexInterpreter(lg, gtgt, config,
gtgt->GetName(), language);
@@ -417,6 +411,34 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines(
return definesString;
}
+std::string cmExtraSublimeTextGenerator::ComputeIncludes(
+ cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* target)
+
+{
+ std::vector<std::string> includes;
+ cmMakefile* makefile = lg->GetMakefile();
+ const std::string& language = source->GetLanguage();
+ const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ cmGeneratorExpressionInterpreter genexInterpreter(
+ lg, target, config, target->GetName(), language);
+
+ // Add include directories for this source file
+ const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES");
+ if (const char* cincludes = source->GetProperty(INCLUDE_DIRECTORIES)) {
+ lg->AppendIncludeDirectories(
+ includes, genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES),
+ *source);
+ }
+
+ // Add include directory flags.
+ lg->GetIncludeDirectories(includes, target, language, config);
+
+ std::string includesString =
+ lg->GetIncludeFlags(includes, target, language, true, false, config);
+
+ return includesString;
+}
+
bool cmExtraSublimeTextGenerator::Open(const std::string& bindir,
const std::string& projectName,
bool dryRun)