diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-05 15:37:50 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-26 17:46:32 (GMT) |
commit | 69329fff70300debf10b62ac08a6bcee9ae7bc3c (patch) | |
tree | 782390e19f3c69c3ed07fdfeacbcbeaaa683007f /Source/cmGeneratorTarget.cxx | |
parent | 0431f2c4d7cbfcd873bc34caee9ed09253e8c8ad (diff) | |
download | CMake-69329fff70300debf10b62ac08a6bcee9ae7bc3c.zip CMake-69329fff70300debf10b62ac08a6bcee9ae7bc3c.tar.gz CMake-69329fff70300debf10b62ac08a6bcee9ae7bc3c.tar.bz2 |
cmGeneratorTarget: Move GetLanguages from cmTarget.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 22b1baf..4ada029 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4416,6 +4416,57 @@ cmGeneratorTarget::GetLinkImplementation(const std::string& config) const } //---------------------------------------------------------------------------- +void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, + const std::string& config) const +{ + std::vector<cmSourceFile*> sourceFiles; + this->Target->GetSourceFiles(sourceFiles, config); + for(std::vector<cmSourceFile*>::const_iterator + i = sourceFiles.begin(); i != sourceFiles.end(); ++i) + { + const std::string& lang = (*i)->GetLanguage(); + if(!lang.empty()) + { + languages.insert(lang); + } + } + + std::vector<cmGeneratorTarget*> objectLibraries; + std::vector<cmSourceFile const*> externalObjects; + if (!this->Makefile->IsConfigured()) + { + std::vector<cmTarget*> objectTargets; + this->Target->GetObjectLibrariesCMP0026(objectTargets); + objectLibraries.reserve(objectTargets.size()); + for (std::vector<cmTarget*>::const_iterator it = objectTargets.begin(); + it != objectTargets.end(); ++it) + { + objectLibraries.push_back(this->GlobalGenerator + ->GetGeneratorTarget(*it)); + } + } + else + { + this->GetExternalObjects(externalObjects, config); + for(std::vector<cmSourceFile const*>::const_iterator + i = externalObjects.begin(); i != externalObjects.end(); ++i) + { + std::string objLib = (*i)->GetObjectLibrary(); + if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLib)) + { + objectLibraries.push_back(this->GlobalGenerator + ->GetGeneratorTarget(tgt)); + } + } + } + for(std::vector<cmGeneratorTarget*>::const_iterator + i = objectLibraries.begin(); i != objectLibraries.end(); ++i) + { + (*i)->GetLanguages(languages, config); + } +} + +//---------------------------------------------------------------------------- void cmGeneratorTarget::ComputeLinkImplementationLanguages( const std::string& config, cmOptionalLinkImplementation& impl) const @@ -4423,7 +4474,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLanguages( // This target needs runtime libraries for its source languages. std::set<std::string> languages; // Get languages used in our source files. - this->Target->GetLanguages(languages, config); + this->GetLanguages(languages, config); // Copy the set of langauges to the link implementation. impl.Languages.insert(impl.Languages.begin(), languages.begin(), languages.end()); |