summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraSublimeTextGenerator.cxx
diff options
context:
space:
mode:
authorMorné Chamberlain <thefreeman.za@gmail.com>2012-10-14 15:37:51 (GMT)
committerMorné Chamberlain <thefreeman.za@gmail.com>2012-10-14 15:37:51 (GMT)
commit9cd3e7071f1769eb6bd751a501d36c6130019a1a (patch)
tree0eb84b3cdfcb26e726ab797d6cbd5192c0550d1a /Source/cmExtraSublimeTextGenerator.cxx
parent44f35f7824c0d97d575ab566a1f9fd1c83be8fc8 (diff)
downloadCMake-9cd3e7071f1769eb6bd751a501d36c6130019a1a.zip
CMake-9cd3e7071f1769eb6bd751a501d36c6130019a1a.tar.gz
CMake-9cd3e7071f1769eb6bd751a501d36c6130019a1a.tar.bz2
Fixed Sublime Text project generation for in-source builds
Fixed the issue where for in-source builds the source directory (which is also the build directory) was excluded from the project file.
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx40
1 files changed, 26 insertions, 14 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 5c20ef9..ea15be5 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -107,26 +107,38 @@ void cmExtraSublimeTextGenerator
const std::string &sourceRootRelativeToOutput = cmSystemTools::RelativePath(
lgs[0]->GetMakefile()->GetHomeOutputDirectory(),
lgs[0]->GetMakefile()->GetHomeDirectory());
- const std::string &outputRelativeToSourceRoot = cmSystemTools::RelativePath(
- lgs[0]->GetMakefile()->GetHomeDirectory(),
- lgs[0]->GetMakefile()->GetHomeOutputDirectory());
// Write the folder entries to the project file
fout << "{\n";
fout << "\t\"folders\":\n\t[\n\t";
- fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\",\n";
- fout << "\t\t\t\"folder_exclude_patterns\": [\"" <<
- outputRelativeToSourceRoot << "\"],\n";
- fout << "\t\t\t\"file_exclude_patterns\": []\n";
- fout << "\t\t},\n\t";
+ if (!sourceRootRelativeToOutput.empty())
+ {
+ fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\"";
+ const std::string &outputRelativeToSourceRoot =
+ cmSystemTools::RelativePath(lgs[0]->GetMakefile()->GetHomeDirectory(),
+ lgs[0]->GetMakefile()->
+ GetHomeOutputDirectory());
+ fout << ",\n\t\t\t\"folder_exclude_patterns\": [\"" <<
+ outputRelativeToSourceRoot << "\"]";
+ }
+ else
+ {
+ fout << "\t{\n\t\t\t\"path\": \"./\"";
+ }
+ fout << "\n\t\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";
+ // that no files or subfolders are included.
+ // In the case of an in-source build, however, this must not be used, since
+ // it'll end up excluding the source directory.
+ if (!sourceRootRelativeToOutput.empty())
+ {
+ fout << ",\n\t\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}";
+ }
// End of the folders section
- fout << "]";
+ fout << "\n\t]";
// Write the beginning of the build systems section to the project file
fout << ",\n\t\"build_systems\":\n\t[\n\t";