diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-16 17:19:48 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-16 18:17:22 (GMT) |
commit | 60bd9f9c92faae368fab1c44cf81b489c6a875cb (patch) | |
tree | 08057c1b8f5c2a603cb9a77f8f103b75dd362af8 /Source/cmGeneratorTarget.cxx | |
parent | 82a6eaf4d0381f0e3236dbd067fe853653bbe6b5 (diff) | |
download | CMake-60bd9f9c92faae368fab1c44cf81b489c6a875cb.zip CMake-60bd9f9c92faae368fab1c44cf81b489c6a875cb.tar.gz CMake-60bd9f9c92faae368fab1c44cf81b489c6a875cb.tar.bz2 |
cmGeneratorTarget: Move GetObjectLibrariesCMP0026 from cmTarget.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e4abfd3..9b3bf28 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5201,6 +5201,46 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( } //---------------------------------------------------------------------------- +void cmGeneratorTarget::GetObjectLibrariesCMP0026( + std::vector<cmGeneratorTarget*>& objlibs) const +{ + // At configure-time, this method can be called as part of getting the + // LOCATION property or to export() a file to be include()d. However + // there is no cmGeneratorTarget at configure-time, so search the SOURCES + // for TARGET_OBJECTS instead for backwards compatibility with OLD + // behavior of CMP0024 and CMP0026 only. + cmStringRange rng = this->Target->GetSourceEntries(); + for(std::vector<std::string>::const_iterator + i = rng.begin(); i != rng.end(); ++i) + { + std::string const& entry = *i; + + std::vector<std::string> files; + cmSystemTools::ExpandListArgument(entry, files); + for (std::vector<std::string>::const_iterator + li = files.begin(); li != files.end(); ++li) + { + if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") && + (*li)[li->size() - 1] == '>') + { + std::string objLibName = li->substr(17, li->size()-18); + + if (cmGeneratorExpression::Find(objLibName) != std::string::npos) + { + continue; + } + cmGeneratorTarget *objLib = + this->LocalGenerator->FindGeneratorTargetToUse(objLibName); + if(objLib) + { + objlibs.push_back(objLib); + } + } + } + } +} + +//---------------------------------------------------------------------------- void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, const std::string& config) const { @@ -5220,14 +5260,13 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, std::vector<cmSourceFile const*> externalObjects; if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) { - std::vector<cmTarget*> objectTargets; - this->Target->GetObjectLibrariesCMP0026(objectTargets); + std::vector<cmGeneratorTarget*> objectTargets; + this->GetObjectLibrariesCMP0026(objectTargets); objectLibraries.reserve(objectTargets.size()); - for (std::vector<cmTarget*>::const_iterator it = objectTargets.begin(); - it != objectTargets.end(); ++it) + for (std::vector<cmGeneratorTarget*>::const_iterator it = + objectTargets.begin(); it != objectTargets.end(); ++it) { - objectLibraries.push_back(this->GlobalGenerator - ->GetGeneratorTarget(*it)); + objectLibraries.push_back(*it); } } else |