diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-11-18 03:47:23 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-11-21 14:42:58 (GMT) |
commit | d8182105a1d62307aa5f5aa8388e074ecacf0773 (patch) | |
tree | d6f84e777b08b929fbfc5dc19523fe730d80b0d7 | |
parent | ee4e85e615aa21323f4d5c88a162e4ddc1e83c46 (diff) | |
download | CMake-d8182105a1d62307aa5f5aa8388e074ecacf0773.zip CMake-d8182105a1d62307aa5f5aa8388e074ecacf0773.tar.gz CMake-d8182105a1d62307aa5f5aa8388e074ecacf0773.tar.bz2 |
cmGeneratorTarget: add a query for targets with objects in the source list
This will be eventually be used to inform the collator of this
information so that Fortran modules provided by the resulting objects
can also be used as intended.
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 27 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 5 |
2 files changed, 23 insertions, 9 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 333ed07..29d2af3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8052,21 +8052,30 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, objectLibraries.insert(gt); } } else { - std::vector<cmSourceFile const*> externalObjects; - this->GetExternalObjects(externalObjects, config); - for (cmSourceFile const* extObj : externalObjects) { - std::string objLib = extObj->GetObjectLibrary(); - if (cmGeneratorTarget* tgt = - this->LocalGenerator->FindGeneratorTargetToUse(objLib)) { - objectLibraries.insert(tgt); - } - } + objectLibraries = this->GetSourceObjectLibraries(config); } for (cmGeneratorTarget const* objLib : objectLibraries) { objLib->GetLanguages(languages, config); } } +std::set<cmGeneratorTarget const*> cmGeneratorTarget::GetSourceObjectLibraries( + std::string const& config) const +{ + std::set<cmGeneratorTarget const*> objectLibraries; + std::vector<cmSourceFile const*> externalObjects; + this->GetExternalObjects(externalObjects, config); + for (cmSourceFile const* extObj : externalObjects) { + std::string objLib = extObj->GetObjectLibrary(); + if (cmGeneratorTarget* tgt = + this->LocalGenerator->FindGeneratorTargetToUse(objLib)) { + objectLibraries.insert(tgt); + } + } + + return objectLibraries; +} + bool cmGeneratorTarget::IsLanguageUsed(std::string const& language, std::string const& config) const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bf49914..2a301e3 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -463,6 +463,11 @@ public: bool IsLanguageUsed(std::string const& language, std::string const& config) const; + // Get the set of targets directly referenced via `TARGET_OBJECTS` in the + // source list for a configuration. + std::set<cmGeneratorTarget const*> GetSourceObjectLibraries( + std::string const& config) const; + bool IsCSharpOnly() const; bool IsDotNetSdkTarget() const; |