From ef8aa081a164817d1d78b6df8ebcf23e421d422f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morn=C3=A9=20Chamberlain?= Date: Sat, 13 Oct 2012 11:20:09 +0200 Subject: Fixed support for the Ninja build system. --- Source/cmExtraSublimeTextGenerator.cxx | 41 +++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 6a95aa3..1338241 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -29,7 +29,12 @@ # define PATH_SEP "/" #endif -/* Some useful URLs: +/* +Sublime Text 2 Generator +Author: Morné Chamberlain +This generator was initially based off of the CodeBlocks generator. + +Some useful URLs: Homepage: http://www.sublimetext.com/ @@ -257,7 +262,6 @@ void cmExtraSublimeTextGenerator:: std::stringstream& fileIncludePatternsStream, std::set& folderIncludePatternsSet) { - // Convert const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT"); for (std::vector::const_iterator jt = allFiles.begin(); jt != allFiles.end(); @@ -481,8 +485,17 @@ void cmExtraSublimeTextGenerator::AppendTarget(cmGeneratedFileStream& fout, } // Write out the build_system data for this target - std::string makefileName = makefile->GetStartOutputDirectory(); - makefileName += "/Makefile"; + std::string makefileName = makefile->GetHomeOutputDirectory(); + // Ninja uses ninja.build files (look for a way to get the output file name + // from cmMakefile) + if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + { + makefileName += "/build.ninja"; + } + else + { + makefileName += "/Makefile"; + } if (!firstTarget) { fout << ",\n\t"; @@ -513,20 +526,28 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( command += target; command += "\""; } - else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) { - // no escaping of spaces in this case, see - // http://public.kitware.com/Bug/view.php?id=10014 - std::string makefileName = makefile; + std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += ", \"-f\", \""; command += makefileName + "\""; - command += ", \"VERBOSE=1\", \""; + command += ", \"-v\", \""; command += target; command += "\""; } else { - std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); + std::string makefileName; + if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + { + // no escaping of spaces in this case, see + // http://public.kitware.com/Bug/view.php?id=10014 + makefileName = makefile; + } + else + { + makefileName = cmSystemTools::ConvertToOutputPath(makefile); + } command += ", \"-f\", \""; command += makefileName + "\""; command += ", \"VERBOSE=1\", \""; -- cgit v0.12