diff options
author | Morné Chamberlain <thefreeman.za@gmail.com> | 2012-10-14 12:06:20 (GMT) |
---|---|---|
committer | Morné Chamberlain <thefreeman.za@gmail.com> | 2012-10-14 12:06:20 (GMT) |
commit | 44f35f7824c0d97d575ab566a1f9fd1c83be8fc8 (patch) | |
tree | 8d6a5f8c8498febc53d816783cf71256ae7516b9 | |
parent | 9657acb55a62f2e37a0378d01e93ab2ee4d151be (diff) | |
download | CMake-44f35f7824c0d97d575ab566a1f9fd1c83be8fc8.zip CMake-44f35f7824c0d97d575ab566a1f9fd1c83be8fc8.tar.gz CMake-44f35f7824c0d97d575ab566a1f9fd1c83be8fc8.tar.bz2 |
Added a CMAKE_SUBLIMECLANG_DISABLED variable that disables SublimeClang.
If the CMAKE_SUBLIMECLANG_DISABLED variable is on then SublimeClang
is disabled in the generated project file. This is useful in large
projects where SublimeClang might run slowly or perform poorly.
-rw-r--r-- | Source/cmDocumentVariables.cxx | 9 | ||||
-rw-r--r-- | Source/cmExtraSublimeTextGenerator.cxx | 14 |
2 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 8db0e8f..6232162 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -896,6 +896,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm) " script, it may get fatal error messages from the script.",false, "Variables That Change Behavior"); + cm->DefineProperty + ("CMAKE_SUBLIMECLANG_DISABLED", cmProperty::VARIABLE, + "Used by the Sublime Text 2 generator to disable SublimeClang in " + "generated project files.", + "For very large projects SublimeClang might run slowly. Set this variable" + " to TRUE to instruct the Sublime Text 2 generator to disable " + " SublimeClang in the generated project files.", false, + "Variables That Change Behavior"); + // Variables defined by CMake that describe the system cm->DefineProperty diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index af26965..5c20ef9 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -47,7 +47,7 @@ void cmExtraSublimeTextGenerator "Project files for Sublime Text 2 will be created in the top directory " "and in every subdirectory which features a CMakeLists.txt file " "containing a PROJECT() call. " - "Additionally a hierarchy of makefiles is generated into the " + "Additionally Makefiles (or build.ninja files) are generated into the " "build tree. The appropriate make program can build the project through " "the default make target. A \"make install\" target is also provided."; } @@ -142,6 +142,18 @@ void cmExtraSublimeTextGenerator // Write the settings section with sublimeclang options fout << ",\n\t\"settings\":\n\t{\n\t"; + // Check if the CMAKE_SUBLIMECLANG_DISABLED flag has been set. If it has + // disable sublimeclang for this project. + const char* sublimeclangDisabledValue = + lgs[0]->GetMakefile()->GetSafeDefinition("CMAKE_SUBLIMECLANG_DISABLED"); + bool sublimeclangEnabled = cmSystemTools::IsOff(sublimeclangDisabledValue); + // Per project sublimeclang settings override default and user settings, + // so we only write the sublimeclang_enabled setting to the project file + // if it is set to be disabled. + if (!sublimeclangEnabled) + { + fout << "\t\"sublimeclang_enabled\": false,\n\t"; + } fout << "\t\"sublimeclang_options\":\n\t\t[\n\t\t"; std::set<std::string>::const_iterator stringSetIter = includeDirs.begin(); while (stringSetIter != includeDirs.end()) |