diff options
author | Bruno Pedrosa <brupelo@gmail.com> | 2016-10-10 19:18:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-10-12 16:38:00 (GMT) |
commit | 19ffc0729fdc12b8c0874db7ae1c5e576b48ba10 (patch) | |
tree | e30bb9ea524a85352ea30081173600c42587308f /Source/cmExtraSublimeTextGenerator.cxx | |
parent | 8eb6038d0d98da7f7e04462a72bd2e7529a7baff (diff) | |
download | CMake-19ffc0729fdc12b8c0874db7ae1c5e576b48ba10.zip CMake-19ffc0729fdc12b8c0874db7ae1c5e576b48ba10.tar.gz CMake-19ffc0729fdc12b8c0874db7ae1c5e576b48ba10.tar.bz2 |
Sublime: Exclude build tree from source tree project only optionally
Create a `CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE` variable to control
addition of the build tree to `folder_exclude_patterns` in the
`.sublime-project`. Change the default of this behavior to OFF.
Closes: #16351
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r-- | Source/cmExtraSublimeTextGenerator.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5ae969b..41f82a2 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -55,10 +55,14 @@ cmExtraSublimeTextGenerator::GetFactory() cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator() : cmExternalMakefileProjectGenerator() { + this->ExcludeBuildFolder = false; } void cmExtraSublimeTextGenerator::Generate() { + this->ExcludeBuildFolder = this->GlobalGenerator->GlobalSettingIsOn( + "CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE"); + // for each sub project in the project create a sublime text 2 project for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); @@ -84,6 +88,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile( const std::vector<cmLocalGenerator*>& lgs, const std::string& filename) { const cmMakefile* mf = lgs[0]->GetMakefile(); + cmGeneratedFileStream fout(filename.c_str()); if (!fout) { return; @@ -102,8 +107,10 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile( if ((!outputRelativeToSourceRoot.empty()) && ((outputRelativeToSourceRoot.length() < 3) || (outputRelativeToSourceRoot.substr(0, 3) != "../"))) { - fout << ",\n\t\t\t\"folder_exclude_patterns\": [\"" - << outputRelativeToSourceRoot << "\"]"; + if (this->ExcludeBuildFolder) { + fout << ",\n\t\t\t\"folder_exclude_patterns\": [\"" + << outputRelativeToSourceRoot << "\"]"; + } } } else { fout << "\t{\n\t\t\t\"path\": \"./\""; |