Commit 8b496672 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'st2-exclude-patterns-variable'

19ffc072 Sublime: Exclude build tree from source tree project only optionally
parents dabd1779 19ffc072
...@@ -159,6 +159,7 @@ Variables that Change Behavior ...@@ -159,6 +159,7 @@ Variables that Change Behavior
/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY /variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
/variable/CMAKE_STAGING_PREFIX /variable/CMAKE_STAGING_PREFIX
/variable/CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
/variable/CMAKE_SYSTEM_APPBUNDLE_PATH /variable/CMAKE_SYSTEM_APPBUNDLE_PATH
/variable/CMAKE_SYSTEM_FRAMEWORK_PATH /variable/CMAKE_SYSTEM_FRAMEWORK_PATH
/variable/CMAKE_SYSTEM_IGNORE_PATH /variable/CMAKE_SYSTEM_IGNORE_PATH
......
st2-exclude-patterns-variable
-----------------------------
* The :generator:`Sublime Text 2` extra generator no longer excludes the
build tree from the ``.sublime-project`` when it is inside the source tree.
The :variable:`CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE` variable
was added to control the behavior explicitly.
CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
---------------------------------------
If this variable evaluates to ``ON`` at the end of the top-level
``CMakeLists.txt`` file, the :generator:`Sublime Text 2` extra generator
excludes the build tree from the ``.sublime-project`` if it is inside the
source tree.
...@@ -55,10 +55,14 @@ cmExtraSublimeTextGenerator::GetFactory() ...@@ -55,10 +55,14 @@ cmExtraSublimeTextGenerator::GetFactory()
cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator() cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator()
: cmExternalMakefileProjectGenerator() : cmExternalMakefileProjectGenerator()
{ {
this->ExcludeBuildFolder = false;
} }
void cmExtraSublimeTextGenerator::Generate() 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 each sub project in the project create a sublime text 2 project
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
it = this->GlobalGenerator->GetProjectMap().begin(); it = this->GlobalGenerator->GetProjectMap().begin();
...@@ -84,6 +88,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile( ...@@ -84,6 +88,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
const std::vector<cmLocalGenerator*>& lgs, const std::string& filename) const std::vector<cmLocalGenerator*>& lgs, const std::string& filename)
{ {
const cmMakefile* mf = lgs[0]->GetMakefile(); const cmMakefile* mf = lgs[0]->GetMakefile();
cmGeneratedFileStream fout(filename.c_str()); cmGeneratedFileStream fout(filename.c_str());
if (!fout) { if (!fout) {
return; return;
...@@ -102,9 +107,11 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile( ...@@ -102,9 +107,11 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
if ((!outputRelativeToSourceRoot.empty()) && if ((!outputRelativeToSourceRoot.empty()) &&
((outputRelativeToSourceRoot.length() < 3) || ((outputRelativeToSourceRoot.length() < 3) ||
(outputRelativeToSourceRoot.substr(0, 3) != "../"))) { (outputRelativeToSourceRoot.substr(0, 3) != "../"))) {
if (this->ExcludeBuildFolder) {
fout << ",\n\t\t\t\"folder_exclude_patterns\": [\"" fout << ",\n\t\t\t\"folder_exclude_patterns\": [\""
<< outputRelativeToSourceRoot << "\"]"; << outputRelativeToSourceRoot << "\"]";
} }
}
} else { } else {
fout << "\t{\n\t\t\t\"path\": \"./\""; fout << "\t{\n\t\t\t\"path\": \"./\"";
} }
......
...@@ -64,6 +64,8 @@ private: ...@@ -64,6 +64,8 @@ private:
std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg, std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
cmGeneratorTarget* gtgt); cmGeneratorTarget* gtgt);
bool ExcludeBuildFolder;
}; };
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment