summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorné Chamberlain <thefreeman.za@gmail.com>2012-10-11 20:16:44 (GMT)
committerMorné Chamberlain <thefreeman.za@gmail.com>2012-10-13 07:47:50 (GMT)
commit75b060ff209c02a1d709fa834a853f4750427cb1 (patch)
treecbafa4f7eba998ed2cae38b9f03bf1ba49ce41ae
parent32f79024ba18df5016eb34c9f5fcc8708eaca83a (diff)
downloadCMake-75b060ff209c02a1d709fa834a853f4750427cb1.zip
CMake-75b060ff209c02a1d709fa834a853f4750427cb1.tar.gz
CMake-75b060ff209c02a1d709fa834a853f4750427cb1.tar.bz2
Changed SublimeClang include path generation to expand to absolute paths.
Fixed an issue where compiler definitions for SublimeClang were not written to the project file.
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index d9000ca..486658d 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -227,6 +227,13 @@ void cmExtraSublimeTextGenerator
fout << "],\n";
fout << "\t\t\t\"file_include_patterns\": [" <<
fileIncludePatternsStream.str() << "]\n";
+ fout << "\t\t},\n\t";
+ // In order for SublimeClang's path resolution to work, the directory that
+ // contains the sublime-project file must be included here. We just ensure
+ // that no files or subfolders are included
+ fout << "\t{\n\t\t\t\"path\": \"./\",\n";
+ fout << "\t\t\t\"folder_exclude_patterns\": [\"*\"],\n";
+ fout << "\t\t\t\"file_exclude_patterns\": [\"*\"]\n";
fout << "\t\t}\n\t";
// End of the folders section
fout << "]";
@@ -340,9 +347,13 @@ void cmExtraSublimeTextGenerator
const std::string &relative = cmSystemTools::RelativePath(
lgs[0]->GetMakefile()->GetHomeOutputDirectory(),
includeDir.c_str());
- fout << "\t\"-I" << relative << "\"";
+ // It appears that a relative path to the sublime-project file doesn't
+ // always work. So we use ${folder:${project_path:<project_filename>}}
+ // that SublimeClang will expand to the correct path
+ fout << "\t\"-I${folder:${project_path:" << mf->GetProjectName() <<
+ ".sublime-project}}/" << relative << "\"";
stringSetIter++;
- if (stringSetIter != includeDirs.end())
+ if ((stringSetIter != includeDirs.end()) || (!defines.empty()))
{
fout << ",";
}
@@ -387,7 +398,7 @@ void cmExtraSublimeTextGenerator::AppendTarget(cmGeneratedFileStream& fout,
->GetGeneratorTarget(target);
std::string cdefs = gtgt->GetCompileDefinitions();
- if(cdefs.empty())
+ if(!cdefs.empty())
{
// Expand the list.
std::vector<std::string> defs;