diff options
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r-- | Source/cmExtraSublimeTextGenerator.cxx | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 604bfcc15f..f973a844cc 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -41,7 +41,7 @@ http://sublimetext.info/docs/en/reference/build_systems.html //---------------------------------------------------------------------------- void cmExtraSublimeTextGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates Sublime Text 2 project files."; @@ -64,7 +64,7 @@ cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator() void cmExtraSublimeTextGenerator::Generate() { // for each sub project in the project create a sublime text 2 project - for (std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator + for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) @@ -223,7 +223,7 @@ void cmExtraSublimeTextGenerator:: void cmExtraSublimeTextGenerator:: AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmLocalGenerator* lg, cmTarget* target, const char* make, @@ -290,7 +290,7 @@ void cmExtraSublimeTextGenerator:: // Ninja uses ninja.build files (look for a way to get the output file name // from cmMakefile or something) std::string makefileName; - if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + if (this->GlobalGenerator->GetName() == "Ninja") { makefileName = "build.ninja"; } @@ -315,11 +315,13 @@ void cmExtraSublimeTextGenerator:: // Create the command line for building the given target using the selected // make std::string cmExtraSublimeTextGenerator::BuildMakeCommand( - const std::string& make, const char* makefile, const char* target) + const std::string& make, const char* makefile, + const std::string& target) { std::string command = "\""; command += make + "\""; - if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) + std::string generator = this->GlobalGenerator->GetName(); + if (generator == "NMake Makefiles") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += ", \"/NOLOGO\", \"/f\", \""; @@ -328,7 +330,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( command += target; command += "\""; } - else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + else if (generator == "Ninja") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += ", \"-f\", \""; @@ -340,7 +342,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( else { std::string makefileName; - if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + if (generator == "MinGW Makefiles") { // no escaping of spaces in this case, see // http://public.kitware.com/Bug/view.php?id=10014 @@ -369,12 +371,12 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, std::string flags; cmMakefile *makefile = lg->GetMakefile(); - const char* language = source->GetLanguage(); - if (language == NULL) + std::string language = source->GetLanguage(); + if (language.empty()) { language = "C"; } - const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add language-specific flags. lg->AddLanguageFlags(flags, language, config); @@ -423,12 +425,8 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, { std::set<std::string> defines; cmMakefile *makefile = lg->GetMakefile(); - const char* language = source->GetLanguage(); - if (language == NULL) - { - language = ""; - } - const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + const std::string& language = source->GetLanguage(); + const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add the export symbol definition for shared library objects. if(const char* exportMacro = target->GetExportMacro()) |