diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-07 17:25:29 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-10 09:04:39 (GMT) |
commit | a367416cec8297c5a567825217b933f4539a44e4 (patch) | |
tree | 54d57c0bfd583f97699c7dad5e4d218f16689e20 /Source | |
parent | bbef3c2da83b7a69d1f99b21dc92d5506d98fb35 (diff) | |
download | CMake-a367416cec8297c5a567825217b933f4539a44e4.zip CMake-a367416cec8297c5a567825217b933f4539a44e4.tar.gz CMake-a367416cec8297c5a567825217b933f4539a44e4.tar.bz2 |
cmLocalGenerator: Add current source directory accessor.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 1 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 2 |
10 files changed, 20 insertions, 14 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index cca3858..fdfa35e 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -497,7 +497,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() std::string sourceLinkedResourceName = "[Source directory]"; std::string linkSourceDirectory = this->GetEclipsePath( - mf->GetCurrentSourceDirectory()); + lg->GetCurrentSourceDirectory()); // .project dir can't be subdir of a linked resource dir if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory, linkSourceDirectory)) @@ -638,7 +638,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( ++it) { std::string linkSourceDirectory = this->GetEclipsePath( - it->second[0]->GetMakefile()->GetCurrentSourceDirectory()); + it->second[0]->GetCurrentSourceDirectory()); // a linked resource must not point to a parent directory of .project or // .project itself if ((baseDir != linkSourceDirectory) && diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c7e09b9..8693785 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2105,7 +2105,7 @@ cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const for(std::vector<cmLocalGenerator*>::const_iterator it = this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it) { - std::string sd = (*it)->GetMakefile()->GetCurrentSourceDirectory(); + std::string sd = (*it)->GetCurrentSourceDirectory(); if (sd == start_dir) { return *it; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b2d8f4a..04441eb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -412,8 +412,9 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) { this->CurrentProject = root->GetProjectName(); this->SetCurrentLocalGenerator(root); - cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(), - this->ProjectSourceDirectoryComponents); + cmSystemTools::SplitPath( + this->CurrentLocalGenerator->GetCurrentSourceDirectory(), + this->ProjectSourceDirectoryComponents); cmSystemTools::SplitPath( this->CurrentLocalGenerator->GetCurrentBinaryDirectory(), this->ProjectOutputDirectoryComponents); @@ -461,7 +462,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, mf->AddGeneratorTarget(allbuild, allBuildGt); // Refer to the main build configuration file for easy editing. - std::string listfile = mf->GetCurrentSourceDirectory(); + std::string listfile = root->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; allBuildGt->AddSource(listfile.c_str()); @@ -557,7 +558,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target); // Refer to the build configuration file for easy editing. - listfile = lg->GetMakefile()->GetCurrentSourceDirectory(); + listfile = lg->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; targetGT->AddSource(listfile.c_str()); @@ -3372,7 +3373,7 @@ bool cmGlobalXCodeGenerator // Point Xcode at the top of the source tree. { std::string pdir = - this->RelativeToBinary(root->GetMakefile()->GetCurrentSourceDirectory()); + this->RelativeToBinary(root->GetCurrentSourceDirectory()); this->RootObject->AddAttribute("projectDirPath", this->CreateString(pdir.c_str())); this->RootObject->AddAttribute("projectRoot", this->CreateString("")); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8096bd7..c0c50c4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2883,6 +2883,11 @@ const char* cmLocalGenerator::GetCurrentBinaryDirectory() const return this->StateSnapshot.GetDirectory().GetCurrentBinary(); } +const char* cmLocalGenerator::GetCurrentSourceDirectory() const +{ + return this->StateSnapshot.GetDirectory().GetCurrentSource(); +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator::GetTargetDirectory(cmTarget const&) const diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 7ca587e..8070667 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -259,6 +259,7 @@ public: const char* GetBinaryDirectory() const; const char* GetCurrentBinaryDirectory() const; + const char* GetCurrentSourceDirectory() const; /** * Generate a Mac OS X application bundle Info.plist file. diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index c226b46..4d024e1 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -215,7 +215,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) dspname += ".dsp.cmake"; cmCustomCommandLine commandLine; commandLine.push_back(cmSystemTools::GetCMakeCommand()); - std::string makefileIn = this->Makefile->GetCurrentSourceDirectory(); + std::string makefileIn = this->GetCurrentSourceDirectory(); makefileIn += "/"; makefileIn += "CMakeLists.txt"; if(!cmSystemTools::FileExists(makefileIn.c_str())) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a94113a..082b7c3 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -282,7 +282,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() stampName += "generate.stamp"; cmCustomCommandLine commandLine; commandLine.push_back(cmSystemTools::GetCMakeCommand()); - std::string makefileIn = this->Makefile->GetCurrentSourceDirectory(); + std::string makefileIn = this->GetCurrentSourceDirectory(); makefileIn += "/"; makefileIn += "CMakeLists.txt"; makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str()); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9c71a10..7bee268 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1114,7 +1114,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << this->Convert(this->LocalGenerator->GetSourceDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " - << this->Convert(this->Makefile->GetCurrentSourceDirectory(), + << this->Convert(this->LocalGenerator->GetCurrentSourceDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " << this->Convert(this->LocalGenerator->GetBinaryDirectory(), diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d792ba7..133d2ff 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -45,8 +45,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) // We only want to process global targets that live in the home // (i.e. top-level) directory. CMake creates copies of these targets // in every directory, which we don't need. - cmMakefile *mf = target->Target->GetMakefile(); - if (strcmp(mf->GetCurrentSourceDirectory(), + if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(), target->GetLocalGenerator()->GetSourceDirectory()) == 0) return new cmNinjaUtilityTargetGenerator(target); // else fallthrough diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8cefd7c..92b7a57 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2243,7 +2243,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( { // Look through the sources for AndroidManifest.xml and use // its location as the root source directory. - std::string rootDir = this->Makefile->GetCurrentSourceDirectory(); + std::string rootDir = this->LocalGenerator->GetCurrentSourceDirectory(); { std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, ""); |