From 12cb3bdce4b40c39b8697bbf89ea8aace6aeae8b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 7 Oct 2015 01:17:48 +0200 Subject: cmLocalGenerator: Add Home directory accessors. Reduce reasons for cmLocalGenerator to have a cmMakefile. --- Source/cmComputeLinkInformation.cxx | 5 +++-- Source/cmExportFileGenerator.cxx | 6 ++++-- Source/cmExtraCodeBlocksGenerator.cxx | 6 +++--- Source/cmExtraCodeLiteGenerator.cxx | 4 ++-- Source/cmExtraEclipseCDT4Generator.cxx | 14 +++++++------- Source/cmExtraKateGenerator.cxx | 29 +++++++++++++---------------- Source/cmExtraSublimeTextGenerator.cxx | 12 ++++++------ Source/cmGhsMultiTargetGenerator.cxx | 6 ++++-- Source/cmGlobalGenerator.cxx | 6 ++---- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 5 ++--- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 4 ++-- Source/cmGlobalXCodeGenerator.cxx | 8 ++++---- Source/cmLocalGenerator.cxx | 10 ++++++++++ Source/cmLocalGenerator.h | 3 +++ Source/cmLocalUnixMakefileGenerator3.cxx | 24 ++++++++++++------------ Source/cmLocalVisualStudio6Generator.cxx | 6 +++--- Source/cmLocalVisualStudio7Generator.cxx | 6 +++--- Source/cmMakefileTargetGenerator.cxx | 8 ++++---- Source/cmNinjaNormalTargetGenerator.cxx | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaUtilityTargetGenerator.cxx | 4 ++-- 23 files changed, 94 insertions(+), 82 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index d35b566..e97069f 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1975,8 +1975,9 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, else if(use_link_rpath) { // Do not add any path inside the source or build tree. - const char* topSourceDir = this->Makefile->GetHomeDirectory(); - const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory(); + const char* topSourceDir = this->CMakeInstance->GetHomeDirectory(); + const char* topBinaryDir = + this->CMakeInstance->GetHomeOutputDirectory(); if(!cmSystemTools::ComparePath(*ri, topSourceDir) && !cmSystemTools::ComparePath(*ri, topBinaryDir) && !cmSystemTools::IsSubDirectory(*ri, topSourceDir) && diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 2a9b72c..c9b6100 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -245,8 +245,10 @@ static bool checkInterfaceDirs(const std::string &prepro, { const char* installDir = target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); - const char* topSourceDir = target->Makefile->GetHomeDirectory(); - const char* topBinaryDir = target->Makefile->GetHomeOutputDirectory(); + const char* topSourceDir = + target->GetLocalGenerator()->GetSourceDirectory(); + const char* topBinaryDir = + target->GetLocalGenerator()->GetBinaryDirectory(); std::vector parts; cmGeneratorExpression::Split(prepro, parts); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 103c16a..b7ada2f 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -273,7 +273,7 @@ void cmExtraCodeBlocksGenerator } const std::string &relative = cmSystemTools::RelativePath( - it->second[0]->GetMakefile()->GetHomeDirectory(), + it->second[0]->GetSourceDirectory(), jt->c_str()); std::vector splitted; cmSystemTools::SplitPath(relative, splitted, false); @@ -297,7 +297,7 @@ void cmExtraCodeBlocksGenerator tree.BuildVirtualFolder(virtualFolders); // And one for std::string unitFiles; - tree.BuildUnit(unitFiles, std::string(mf->GetHomeDirectory()) + "/"); + tree.BuildUnit(unitFiles, std::string(lgs[0]->GetSourceDirectory()) + "/"); // figure out the compiler std::string compiler = this->GetCBCompilerId(mf); @@ -332,7 +332,7 @@ void cmExtraCodeBlocksGenerator // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs if (strcmp(makefile->GetCurrentBinaryDirectory(), - makefile->GetHomeOutputDirectory())==0) + (*lg)->GetBinaryDirectory())==0) { this->AppendTarget(fout, ti->first, 0, make.c_str(), *lg, compiler.c_str()); diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 8fb4dce..c22b786 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -69,11 +69,11 @@ void cmExtraCodeLiteGenerator::Generate() this->ConfigName = GetConfigurationName( mf ); if (strcmp(mf->GetCurrentBinaryDirectory(), - mf->GetHomeOutputDirectory()) == 0) + it->second[0]->GetBinaryDirectory()) == 0) { workspaceOutputDir = mf->GetCurrentBinaryDirectory(); workspaceProjectName = it->second[0]->GetProjectName(); - workspaceSourcePath = mf->GetHomeDirectory(); + workspaceSourcePath = it->second[0]->GetSourceDirectory(); workspaceFileName = workspaceOutputDir+"/"; workspaceFileName += workspaceProjectName + ".workspace"; this->WorkspacePath = mf->GetCurrentBinaryDirectory();; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index a98eef1..47e2566 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -79,8 +79,8 @@ void cmExtraEclipseCDT4Generator //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator::Generate() { - const cmMakefile* mf - = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0]; + const cmMakefile* mf = lg->GetMakefile(); std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION"); cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*"); @@ -106,8 +106,8 @@ void cmExtraEclipseCDT4Generator::Generate() } // TODO: Decide if these are local or member variables - this->HomeDirectory = mf->GetHomeDirectory(); - this->HomeOutputDirectory = mf->GetHomeOutputDirectory(); + this->HomeDirectory = lg->GetSourceDirectory(); + this->HomeOutputDirectory = lg->GetBinaryDirectory(); this->GenerateLinkedResources = mf->IsOn( "CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES"); @@ -226,7 +226,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmState::STRING, true); - mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory()); } else if (envVarValue==0 && cacheValue!=0) { @@ -247,7 +247,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmState::STRING, true); - mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); + mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory()); } } @@ -1091,7 +1091,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const virtDir += prefix; virtDir += ti->first; std::string buildArgs = "-C \""; - buildArgs += makefile->GetHomeOutputDirectory(); + buildArgs += (*it)->GetBinaryDirectory(); buildArgs += "\" "; buildArgs += makeArgs; this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "", diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 104372c..f14a1cc 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -50,7 +50,7 @@ void cmExtraKateGenerator::Generate() const cmMakefile* mf = lg->GetMakefile(); this->ProjectName = this->GenerateProjectName(lg->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), - this->GetPathBasename(mf->GetHomeOutputDirectory())); + this->GetPathBasename(lg->GetBinaryDirectory())); this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja"); this->CreateKateProjectFile(lg); @@ -61,8 +61,7 @@ void cmExtraKateGenerator::Generate() void cmExtraKateGenerator::CreateKateProjectFile( const cmLocalGenerator* lg) const { - const cmMakefile* mf = lg->GetMakefile(); - std::string filename = mf->GetHomeOutputDirectory(); + std::string filename = lg->GetBinaryDirectory(); filename += "/.kateproject"; cmGeneratedFileStream fout(filename.c_str()); if (!fout) @@ -73,9 +72,9 @@ void cmExtraKateGenerator::CreateKateProjectFile( fout << "{\n" "\t\"name\": \"" << this->ProjectName << "\",\n" - "\t\"directory\": \"" << mf->GetHomeDirectory() << "\",\n" - "\t\"files\": [ { " << this->GenerateFilesString(mf) << "} ],\n"; - this->WriteTargets(mf, fout); + "\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n" + "\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n"; + this->WriteTargets(lg, fout); fout << "}\n"; } @@ -84,15 +83,15 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, cmGeneratedFileStream& fout) const { - cmMakefile* mf = lg->GetMakefile(); + cmMakefile const* mf = lg->GetMakefile(); const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); const std::string makeArgs = mf->GetSafeDefinition( "CMAKE_KATE_MAKE_ARGUMENTS"); - const char* homeOutputDir = mf->GetHomeOutputDirectory(); + const char* homeOutputDir = lg->GetBinaryDirectory(); fout << "\t\"build\": {\n" - "\t\t\"directory\": \"" << mf->GetHomeOutputDirectory() << "\",\n" + "\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n" "\t\t\"default_target\": \"all\",\n" "\t\t\"clean_target\": \"clean\",\n"; @@ -123,7 +122,7 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); cmMakefile* makefile=(*it)->GetMakefile(); std::string currentDir = makefile->GetCurrentBinaryDirectory(); - bool topLevel = (currentDir == makefile->GetHomeOutputDirectory()); + bool topLevel = (currentDir == (*it)->GetBinaryDirectory()); for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) { @@ -237,8 +236,7 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile( const cmLocalGenerator* lg) const { - cmMakefile* mf = lg->GetMakefile(); - std::string filename = mf->GetHomeOutputDirectory(); + std::string filename = lg->GetBinaryDirectory(); filename += "/"; filename += this->ProjectName; filename += ".kateproject"; @@ -256,22 +254,21 @@ cmExtraKateGenerator::CreateDummyKateProjectFile( std::string cmExtraKateGenerator::GenerateFilesString(const cmLocalGenerator* lg) const { - cmMakefile* mf = lg->GetMakefile(); - std::string s = mf->GetHomeDirectory(); + std::string s = lg->GetSourceDirectory(); s += "/.git"; if(cmSystemTools::FileExists(s.c_str())) { return std::string("\"git\": 1 "); } - s = mf->GetHomeDirectory(); + s = lg->GetSourceDirectory(); s += "/.svn"; if(cmSystemTools::FileExists(s.c_str())) { return std::string("\"svn\": 1 "); } - s = mf->GetHomeDirectory(); + s = lg->GetSourceDirectory(); s += "/"; std::set files; diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index db8c470..7413a2d 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -99,8 +99,8 @@ void cmExtraSublimeTextGenerator } const std::string &sourceRootRelativeToOutput = cmSystemTools::RelativePath( - mf->GetHomeOutputDirectory(), - mf->GetHomeDirectory()); + lgs[0]->GetBinaryDirectory(), + lgs[0]->GetSourceDirectory()); // Write the folder entries to the project file fout << "{\n"; fout << "\t\"folders\":\n\t[\n\t"; @@ -108,8 +108,8 @@ void cmExtraSublimeTextGenerator { fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\""; const std::string &outputRelativeToSourceRoot = - cmSystemTools::RelativePath(mf->GetHomeDirectory(), - mf->GetHomeOutputDirectory()); + cmSystemTools::RelativePath(lgs[0]->GetSourceDirectory(), + lgs[0]->GetBinaryDirectory()); if ((!outputRelativeToSourceRoot.empty()) && ((outputRelativeToSourceRoot.length() < 3) || (outputRelativeToSourceRoot.substr(0, 3) != "../"))) @@ -173,8 +173,8 @@ void cmExtraSublimeTextGenerator:: { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs - if (strcmp(makefile->GetCurrentBinaryDirectory(), - makefile->GetHomeOutputDirectory())==0) + if (strcmp((*lg)->GetCurrentBinaryDirectory(), + (*lg)->GetBinaryDirectory())==0) { this->AppendTarget(fout, ti->first, *lg, 0, make.c_str(), makefile, compiler.c_str(), diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index bfcef43..79e3a4c 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -68,7 +68,9 @@ cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target) std::string cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target) { - return target->GetMakefile()->GetHomeOutputDirectory(); + cmGeneratorTarget* gt = target->GetMakefile()->GetGlobalGenerator() + ->GetGeneratorTarget(target); + return gt->GetLocalGenerator()->GetBinaryDirectory(); } std::string @@ -450,7 +452,7 @@ void cmGhsMultiTargetGenerator::WriteSources( cmSystemTools::ConvertToUnixSlashes(sgPath); cmGlobalGhsMultiGenerator::AddFilesUpToPath( this->GetFolderBuildStreams(), &this->FolderBuildStreams, - this->Makefile->GetHomeOutputDirectory(), sgPath, + this->LocalGenerator->GetBinaryDirectory(), sgPath, GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); std::string fullSourcePath((*si)->GetFullPath()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index eb4dfee..c7e09b9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -399,7 +399,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, bool fatalError = false; mf->AddDefinition("RUN_CONFIGURE", true); - std::string rootBin = mf->GetHomeOutputDirectory(); + std::string rootBin = this->CMakeInstance->GetHomeOutputDirectory(); rootBin += cmake::GetCMakeFilesDirectory(); // If the configuration files path has been set, @@ -2879,10 +2879,8 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile) //---------------------------------------------------------------------------- void cmGlobalGenerator::WriteSummary() { - cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); - // Record all target directories in a central location. - std::string fname = mf->GetHomeOutputDirectory(); + std::string fname = this->CMakeInstance->GetHomeOutputDirectory(); fname += cmake::GetCMakeFilesDirectory(); fname += "/TargetDirectories.txt"; cmGeneratedFileStream fout(fname.c_str()); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 0c95be0..6284c6d 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -51,7 +51,7 @@ void cmGlobalKdevelopGenerator::Generate() { cmMakefile* mf = it->second[0]->GetMakefile(); std::string outputDir=mf->GetCurrentBinaryDirectory(); - std::string projectDir=mf->GetHomeDirectory(); + std::string projectDir=it->second[0]->GetSourceDirectory(); std::string projectName=it->second[0]->GetProjectName(); std::string cmakeFilePattern("CMakeLists.txt;*.cmake;"); std::string fileToOpen; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9d8193b..32e6077 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1198,16 +1198,15 @@ void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os) void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) { cmLocalGenerator *lg = this->LocalGenerators[0]; - cmMakefile* mfRoot = lg->GetMakefile(); std::ostringstream cmd; cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL) << " -H" - << lg->ConvertToOutputFormat(mfRoot->GetHomeDirectory(), + << lg->ConvertToOutputFormat(lg->GetSourceDirectory(), cmLocalGenerator::SHELL) << " -B" - << lg->ConvertToOutputFormat(mfRoot->GetHomeOutputDirectory(), + << lg->ConvertToOutputFormat(lg->GetBinaryDirectory(), cmLocalGenerator::SHELL); WriteRule(*this->RulesFileStream, "RERUN_CMAKE", diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index cb13fcf..be35e27 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -784,7 +784,7 @@ cmGlobalUnixMakefileGenerator3 depends.clear(); cmLocalUnixMakefileGenerator3::EchoProgress progress; - progress.Dir = lg->GetMakefile()->GetHomeOutputDirectory(); + progress.Dir = lg->GetBinaryDirectory(); progress.Dir += cmake::GetCMakeFilesDirectory(); { std::ostringstream progressArg; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ab9d7e7..0bdb008 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -312,10 +312,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() cmCustomCommandLine commandLine; commandLine.push_back(cmSystemTools::GetCMakeCommand()); std::string argH = "-H"; - argH += mf->GetHomeDirectory(); + argH += lg->GetSourceDirectory(); commandLine.push_back(argH); std::string argB = "-B"; - argB += mf->GetHomeOutputDirectory(); + argB += lg->GetBinaryDirectory(); commandLine.push_back(argB); commandLine.push_back("--check-stamp-list"); commandLine.push_back(stampList.c_str()); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4d017ab..146fa39 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -590,7 +590,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( (this->CurrentReRunCMakeMakefile.c_str()); makefileStream.SetCopyIfDifferent(true); makefileStream << "# Generated by CMake, DO NOT EDIT\n"; - std::string checkCache = mf->GetHomeOutputDirectory(); + std::string checkCache = root->GetBinaryDirectory(); checkCache += "/"; checkCache += cmake::GetCMakeFilesDirectoryPostSlash(); checkCache += "cmake.check_cache"; @@ -604,9 +604,9 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( makefileStream << "\n\t" << this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand().c_str()) << " -H" << this->ConvertToRelativeForMake( - mf->GetHomeDirectory()) + root->GetSourceDirectory()) << " -B" << this->ConvertToRelativeForMake( - mf->GetHomeOutputDirectory()) << "\n"; + root->GetBinaryDirectory()) << "\n"; } //---------------------------------------------------------------------------- @@ -3749,7 +3749,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, // Since this call may have created new cache entries, save the cache: // root->GetMakefile()->GetCMakeInstance()->SaveCache( - root->GetMakefile()->GetHomeOutputDirectory()); + root->GetBinaryDirectory()); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b7833cd..6c442f4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2868,6 +2868,16 @@ cmake* cmLocalGenerator::GetCMakeInstance() const return this->GlobalGenerator->GetCMakeInstance(); } +const char* cmLocalGenerator::GetSourceDirectory() const +{ + return this->GetCMakeInstance()->GetHomeDirectory(); +} + +const char* cmLocalGenerator::GetBinaryDirectory() const +{ + return this->GetCMakeInstance()->GetHomeOutputDirectory(); +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator::GetTargetDirectory(cmTarget const&) const diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index b3bf8cd..2123f1e 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -255,6 +255,9 @@ public: cmake* GetCMakeInstance() const; + const char* GetSourceDirectory() const; + const char* GetBinaryDirectory() const; + /** * Generate a Mac OS X application bundle Info.plist file. */ diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index b131a63..bf5afc1 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -399,7 +399,7 @@ cmLocalUnixMakefileGenerator3 ); } this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); // Write the rule to the makefile. @@ -449,7 +449,7 @@ void cmLocalUnixMakefileGenerator3 commands.push_back(this->GetRecursiveMakeCall (makefile2.c_str(),localName)); this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Convenience name for target.", localName, depends, commands, true); @@ -478,7 +478,7 @@ void cmLocalUnixMakefileGenerator3 commands.push_back(this->GetRecursiveMakeCall (makefileName.c_str(), makeTargetName)); this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "fast build rule for target.", localName, depends, commands, true); @@ -496,7 +496,7 @@ void cmLocalUnixMakefileGenerator3 commands.push_back(this->GetRecursiveMakeCall (makefile2.c_str(), makeTargetName)); this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Manual pre-install relink rule for target.", @@ -750,13 +750,13 @@ cmLocalUnixMakefileGenerator3 makefileStream << "# The top-level source directory on which CMake was run.\n" << "CMAKE_SOURCE_DIR = " - << this->Convert(this->Makefile->GetHomeDirectory(), FULL, SHELL) + << this->Convert(this->GetSourceDirectory(), FULL, SHELL) << "\n" << "\n"; makefileStream << "# The top-level build directory on which CMake was run.\n" << "CMAKE_BINARY_DIR = " - << this->Convert(this->Makefile->GetHomeOutputDirectory(), FULL, SHELL) + << this->Convert(this->GetBinaryDirectory(), FULL, SHELL) << "\n" << "\n"; } @@ -889,7 +889,7 @@ void cmLocalUnixMakefileGenerator3 if(!this->GetMakefile()->IsRootMakefile()) { this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); } this->WriteMakeRule(makefileStream, @@ -1838,7 +1838,7 @@ void cmLocalUnixMakefileGenerator3 depends.push_back("cmake_check_build_system"); - std::string progressDir = this->Makefile->GetHomeOutputDirectory(); + std::string progressDir = this->GetBinaryDirectory(); progressDir += cmake::GetCMakeFilesDirectory(); { std::ostringstream progCmd; @@ -1862,7 +1862,7 @@ void cmLocalUnixMakefileGenerator3 commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); { std::ostringstream progCmd; @@ -1884,7 +1884,7 @@ void cmLocalUnixMakefileGenerator3 commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "The main clean target", "clean", depends, commands, true); @@ -1914,7 +1914,7 @@ void cmLocalUnixMakefileGenerator3 commands.push_back (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.", "preinstall", depends, commands, true); @@ -1935,7 +1935,7 @@ void cmLocalUnixMakefileGenerator3 runRule += " 1"; commands.push_back(runRule); this->CreateCDCommand(commands, - this->Makefile->GetHomeOutputDirectory(), + this->GetBinaryDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "clear depends", "depend", diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index ab215d1..3f51569 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -112,7 +112,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() { // If not an in source build, then create the output directory if(strcmp(this->Makefile->GetCurrentBinaryDirectory(), - this->Makefile->GetHomeDirectory()) != 0) + this->GetSourceDirectory()) != 0) { if(!cmSystemTools::MakeDirectory (this->Makefile->GetCurrentBinaryDirectory())) @@ -226,10 +226,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) comment += makefileIn; std::string args; args = "-H"; - args += this->Makefile->GetHomeDirectory(); + args += this->GetSourceDirectory(); commandLine.push_back(args); args = "-B"; - args += this->Makefile->GetHomeOutputDirectory(); + args += this->GetBinaryDirectory(); commandLine.push_back(args); std::vector const& listFiles = this->Makefile->GetListFiles(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 8924564..48a633e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -165,7 +165,7 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() { // If not an in source build, then create the output directory if(strcmp(this->Makefile->GetCurrentBinaryDirectory(), - this->Makefile->GetHomeDirectory()) != 0) + this->GetSourceDirectory()) != 0) { if(!cmSystemTools::MakeDirectory (this->Makefile->GetCurrentBinaryDirectory())) @@ -294,10 +294,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() comment += makefileIn; std::string args; args = "-H"; - args += this->Makefile->GetHomeDirectory(); + args += this->GetSourceDirectory(); commandLine.push_back(args); args = "-B"; - args += this->Makefile->GetHomeOutputDirectory(); + args += this->GetBinaryDirectory(); commandLine.push_back(args); commandLine.push_back("--check-stamp-file"); std::string stampFilename = this->Convert(stampName.c_str(), FULL, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index cd499f6..3d7cc72 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1095,7 +1095,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() // translation table for the dependency scanning process. depCmd << "cd " << (this->LocalGenerator->Convert( - this->Makefile->GetHomeOutputDirectory(), + this->LocalGenerator->GetBinaryDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL)) << " && "; #endif @@ -1110,13 +1110,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() // the state of our local generator sufficiently for its needs. depCmd << "$(CMAKE_COMMAND) -E cmake_depends \"" << this->GlobalGenerator->GetName() << "\" " - << this->Convert(this->Makefile->GetHomeDirectory(), + << this->Convert(this->LocalGenerator->GetSourceDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " << this->Convert(this->Makefile->GetCurrentSourceDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " - << this->Convert(this->Makefile->GetHomeOutputDirectory(), + << this->Convert(this->LocalGenerator->GetBinaryDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " << this->Convert(this->Makefile->GetCurrentBinaryDirectory(), @@ -1242,7 +1242,7 @@ void cmMakefileTargetGenerator ::MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress& progress) const { - progress.Dir = this->Makefile->GetHomeOutputDirectory(); + progress.Dir = this->LocalGenerator->GetBinaryDirectory(); progress.Dir += cmake::GetCMakeFilesDirectory(); std::ostringstream progressArg; progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")"; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 24fcaf4..6706287 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -666,8 +666,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (!preLinkCmdLines.empty()) { const std::string homeOutDir = localGen.ConvertToOutputFormat( - mf->GetHomeOutputDirectory(), - cmLocalGenerator::SHELL); + localGen.GetBinaryDirectory(), + cmLocalGenerator::SHELL); preLinkCmdLines.push_back("cd " + homeOutDir); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6e6dc60..d792ba7 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -47,7 +47,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) // in every directory, which we don't need. cmMakefile *mf = target->Target->GetMakefile(); if (strcmp(mf->GetCurrentSourceDirectory(), - mf->GetHomeDirectory()) == 0) + target->GetLocalGenerator()->GetSourceDirectory()) == 0) return new cmNinjaUtilityTargetGenerator(target); // else fallthrough } diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index df43c61..9feb7ac 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -103,13 +103,13 @@ void cmNinjaUtilityTargetGenerator::Generate() command, "$(CMAKE_SOURCE_DIR)", this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetTarget()->GetMakefile()->GetHomeDirectory(), + this->GetLocalGenerator()->GetSourceDirectory(), cmLocalGenerator::SHELL).c_str()); cmSystemTools::ReplaceString( command, "$(CMAKE_BINARY_DIR)", this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetTarget()->GetMakefile()->GetHomeOutputDirectory(), + this->GetLocalGenerator()->GetBinaryDirectory(), cmLocalGenerator::SHELL).c_str()); cmSystemTools::ReplaceString(command, "$(ARGS)", ""); -- cgit v0.12