summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraSublimeTextGenerator.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-10-11 18:58:35 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2017-10-13 19:28:34 (GMT)
commit5de37a4a6474fa569e2ac28d5e9c164b6e7d2f46 (patch)
tree310730d01dd0a79a268c2ce6982ab49fe8b3e171 /Source/cmExtraSublimeTextGenerator.cxx
parentd0b6c2da8b7fda317e11c66a4b133d4a88eaeef6 (diff)
downloadCMake-5de37a4a6474fa569e2ac28d5e9c164b6e7d2f46.zip
CMake-5de37a4a6474fa569e2ac28d5e9c164b6e7d2f46.tar.gz
CMake-5de37a4a6474fa569e2ac28d5e9c164b6e7d2f46.tar.bz2
cmake: Add --open option for IDE generators
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 73a9c85..3d72ae3 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -400,3 +400,26 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines(
return definesString;
}
+
+bool cmExtraSublimeTextGenerator::Open(const std::string& bindir,
+ const std::string& projectName,
+ bool dryRun)
+{
+ const char* sublExecutable =
+ this->GlobalGenerator->GetCMakeInstance()->GetCacheDefinition(
+ "CMAKE_SUBLIMETEXT_EXECUTABLE");
+ if (!sublExecutable) {
+ return false;
+ }
+ if (cmSystemTools::IsNOTFOUND(sublExecutable)) {
+ return false;
+ }
+
+ std::string filename = bindir + "/" + projectName + ".sublime-project";
+ if (dryRun) {
+ return cmSystemTools::FileExists(filename, true);
+ }
+
+ return cmSystemTools::RunSingleCommand(
+ { sublExecutable, "--project", filename });
+}