diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-06 22:29:25 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-08 22:00:18 (GMT) |
commit | 4ab2750c54adb09d147839687858aabe3cd988a7 (patch) | |
tree | 5e65bb636efca9bd1ca447d270882d6894b454b9 | |
parent | c8187f414bcc4668940c2e0fe40d361389efdbe5 (diff) | |
download | CMake-4ab2750c54adb09d147839687858aabe3cd988a7.zip CMake-4ab2750c54adb09d147839687858aabe3cd988a7.tar.gz CMake-4ab2750c54adb09d147839687858aabe3cd988a7.tar.bz2 |
cmLocalGenerator: Add GetProjectName method.
-rw-r--r-- | Source/cmExtraCodeBlocksGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 19 | ||||
-rw-r--r-- | Source/cmExtraKateGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmExtraSublimeTextGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalKdevelopGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio6Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 2 |
13 files changed, 36 insertions, 30 deletions
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 7915a6e..103c16a 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -78,7 +78,7 @@ void cmExtraCodeBlocksGenerator::CreateProjectFile( { const cmMakefile* mf=lgs[0]->GetMakefile(); std::string outputDir=mf->GetCurrentBinaryDirectory(); - std::string projectName=mf->GetProjectName(); + std::string projectName=lgs[0]->GetProjectName(); std::string filename=outputDir+"/"; filename+=projectName+".cbp"; @@ -307,7 +307,7 @@ void cmExtraCodeBlocksGenerator "<CodeBlocks_project_file>\n" " <FileVersion major=\"1\" minor=\"6\" />\n" " <Project>\n" - " <Option title=\"" << mf->GetProjectName()<<"\" />\n" + " <Option title=\"" << lgs[0]->GetProjectName()<<"\" />\n" " <Option makefile_is_custom=\"1\" />\n" " <Option compiler=\"" << compiler << "\" />\n" " "<<virtualFolders<<"\n" diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 496c1a8..8fb4dce 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -72,7 +72,7 @@ void cmExtraCodeLiteGenerator::Generate() mf->GetHomeOutputDirectory()) == 0) { workspaceOutputDir = mf->GetCurrentBinaryDirectory(); - workspaceProjectName = mf->GetProjectName(); + workspaceProjectName = it->second[0]->GetProjectName(); workspaceSourcePath = mf->GetHomeDirectory(); workspaceFileName = workspaceOutputDir+"/"; workspaceFileName += workspaceProjectName + ".workspace"; @@ -93,7 +93,7 @@ void cmExtraCodeLiteGenerator::Generate() // retrive project information const cmMakefile* mf = it->second[0]->GetMakefile(); std::string outputDir = mf->GetCurrentBinaryDirectory(); - std::string projectName = mf->GetProjectName(); + std::string projectName = it->second[0]->GetProjectName(); std::string filename = outputDir + "/" + projectName + ".project"; // Make the project file relative to the workspace @@ -123,7 +123,7 @@ void cmExtraCodeLiteGenerator::CreateProjectFile( { const cmMakefile* mf = lgs[0]->GetMakefile(); std::string outputDir = mf->GetCurrentBinaryDirectory(); - std::string projectName = mf->GetProjectName(); + std::string projectName = lgs[0]->GetProjectName(); std::string filename = outputDir + "/"; filename += projectName + ".project"; @@ -143,7 +143,7 @@ void cmExtraCodeLiteGenerator //////////////////////////////////// fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" - "<CodeLite_Project Name=\"" << mf->GetProjectName() + "<CodeLite_Project Name=\"" << lgs[0]->GetProjectName() << "\" InternalType=\"\">\n"; // Collect all used source files in the project diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 6dc18c2..464d0d9 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -157,9 +157,8 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() assert(this->HomeDirectory != this->HomeOutputDirectory); // set up the project name: <project>-Source@<baseSourcePathName> - const cmMakefile* mf - = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); - std::string name = this->GenerateProjectName(mf->GetProjectName(), "Source", + cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0]; + std::string name = this->GenerateProjectName(lg->GetProjectName(), "Source", this->GetPathBasename(this->HomeDirectory)); const std::string filename = this->HomeDirectory + "/.project"; @@ -259,8 +258,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator::CreateProjectFile() { - cmMakefile* mf - = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0]; + cmMakefile* mf = lg->GetMakefile(); const std::string filename = this->HomeOutputDirectory + "/.project"; @@ -280,7 +279,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<projectDescription>\n" "\t<name>" << - this->GenerateProjectName(mf->GetProjectName(), + this->GenerateProjectName(lg->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), this->GetPathBasename(this->HomeOutputDirectory)) << "</name>\n" @@ -696,8 +695,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { std::set<std::string> emmited; - const cmMakefile* mf - = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0]; + const cmMakefile* mf = lg->GetMakefile(); const std::string filename = this->HomeOutputDirectory + "/.cproject"; @@ -1151,8 +1150,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const fout << "</cconfiguration>\n" "</storageModule>\n" "<storageModule moduleId=\"cdtBuildSystem\" version=\"4.0.0\">\n" - "<project id=\"" << this->EscapeForXML(mf->GetProjectName()) - << ".null.1\" name=\"" << this->EscapeForXML(mf->GetProjectName()) + "<project id=\"" << this->EscapeForXML(lg->GetProjectName()) + << ".null.1\" name=\"" << this->EscapeForXML(lg->GetProjectName()) << "\"/>\n" "</storageModule>\n" "</cproject>\n" diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index f83b5cf..126e3e1 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -46,9 +46,9 @@ cmExtraKateGenerator::cmExtraKateGenerator() void cmExtraKateGenerator::Generate() { - const cmMakefile* mf - = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); - this->ProjectName = this->GenerateProjectName(mf->GetProjectName(), + cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0]; + const cmMakefile* mf = lg->GetMakefile(); + this->ProjectName = this->GenerateProjectName(lg->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), this->GetPathBasename(mf->GetHomeOutputDirectory())); this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja"); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 11410a7..db8c470 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -79,7 +79,7 @@ void cmExtraSublimeTextGenerator::CreateProjectFile( { const cmMakefile* mf=lgs[0]->GetMakefile(); std::string outputDir=mf->GetCurrentBinaryDirectory(); - std::string projectName=mf->GetProjectName(); + std::string projectName=lgs[0]->GetProjectName(); const std::string filename = outputDir + "/" + projectName + ".sublime-project"; @@ -302,7 +302,7 @@ void cmExtraSublimeTextGenerator:: { fout << ",\n\t"; } - fout << "\t{\n\t\t\t\"name\": \"" << makefile->GetProjectName() << " - " << + fout << "\t{\n\t\t\t\"name\": \"" << lg->GetProjectName() << " - " << targetName << "\",\n"; fout << "\t\t\t\"cmd\": [" << this->BuildMakeCommand(make, makefileName.c_str(), targetName) << diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index c40f846..0c95be0 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -52,7 +52,7 @@ void cmGlobalKdevelopGenerator::Generate() cmMakefile* mf = it->second[0]->GetMakefile(); std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectDir=mf->GetHomeDirectory(); - std::string projectName=mf->GetProjectName(); + std::string projectName=it->second[0]->GetProjectName(); std::string cmakeFilePattern("CMakeLists.txt;*.cmake;"); std::string fileToOpen; const std::vector<cmLocalGenerator*>& lgs= it->second; diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 14de698..d5e9417 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -260,7 +260,7 @@ void cmGlobalVisualStudio6Generator } std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory(); fname += "/"; - fname += root->GetMakefile()->GetProjectName(); + fname += root->GetProjectName(); fname += ".dsw"; cmsys::ofstream fout(fname.c_str()); if(!fout) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 05da022..73a952b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -362,10 +362,10 @@ void cmGlobalVisualStudio7Generator { return; } - this->CurrentProject = root->GetMakefile()->GetProjectName(); + this->CurrentProject = root->GetProjectName(); std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory(); fname += "/"; - fname += root->GetMakefile()->GetProjectName(); + fname += root->GetProjectName(); fname += ".sln"; cmGeneratedFileStream fout(fname.c_str()); fout.SetCopyIfDifferent(true); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index d45aa27..6a25ed0 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -250,7 +250,7 @@ cmGlobalVisualStudioGenerator { topLevelSlnName = mf->GetCurrentBinaryDirectory(); topLevelSlnName += "/"; - topLevelSlnName += mf->GetProjectName(); + topLevelSlnName += this->LocalGenerators[0]->GetProjectName(); topLevelSlnName += ".sln"; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3d52e3a..4d017ab 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -410,7 +410,7 @@ void cmGlobalXCodeGenerator::Generate() //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) { - this->CurrentProject = root->GetMakefile()->GetProjectName(); + this->CurrentProject = root->GetProjectName(); this->SetCurrentLocalGenerator(root); cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(), this->ProjectSourceDirectoryComponents); @@ -3342,7 +3342,7 @@ bool cmGlobalXCodeGenerator this->RootObject->SetComment("Project object"); std::string project_id = "PROJECT_"; - project_id += root->GetMakefile()->GetProjectName(); + project_id += root->GetProjectName(); this->RootObject->SetId(this->GetOrCreateId( project_id.c_str(), this->RootObject->GetId()).c_str()); @@ -3729,7 +3729,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, } std::string xcodeDir = root->GetMakefile()->GetCurrentBinaryDirectory(); xcodeDir += "/"; - xcodeDir += root->GetMakefile()->GetProjectName(); + xcodeDir += root->GetProjectName(); xcodeDir += ".xcode"; if(this->XcodeVersion > 20) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6647894..b7833cd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2431,6 +2431,11 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature, return 0; } +std::string cmLocalGenerator::GetProjectName() const +{ + return this->StateSnapshot.GetProjectName(); +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index d9623cb..b3bf8cd 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -182,6 +182,8 @@ public: const std::string& config, const std::string& lang); + std::string GetProjectName() const; + /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index c46adc1..b1e1d3f 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -183,7 +183,7 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); os - << "# Project: " << this->GetMakefile()->GetProjectName() << std::endl + << "# Project: " << this->GetProjectName() << std::endl << "# Configuration: " << this->ConfigName << std::endl ; cmGlobalNinjaGenerator::WriteDivider(os); |