diff options
author | Brad King <brad.king@kitware.com> | 2024-05-16 19:25:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-05-20 23:16:57 (GMT) |
commit | d0fc9325287d343c573c8a9dc1783952fd8555ee (patch) | |
tree | 60ed7631fbf8678acfc87f09ea42073c21ea0d85 /Source/cmGeneratorTarget.cxx | |
parent | abf60adfa6526dc444f65c32427e392aaaa5f976 (diff) | |
download | CMake-d0fc9325287d343c573c8a9dc1783952fd8555ee.zip CMake-d0fc9325287d343c573c8a9dc1783952fd8555ee.tar.gz CMake-d0fc9325287d343c573c8a9dc1783952fd8555ee.tar.bz2 |
cmGeneratorTarget: Factor TargetPropertyEntry into own source
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b82cc23..61b93be 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -118,173 +118,6 @@ cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>( return tgt->GetLocation(config); } -cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem; - -class TargetPropertyEntryString : public cmGeneratorTarget::TargetPropertyEntry -{ -public: - TargetPropertyEntryString(BT<std::string> propertyValue, - cmLinkImplItem const& item = NoLinkImplItem) - : cmGeneratorTarget::TargetPropertyEntry(item) - , PropertyValue(std::move(propertyValue)) - { - } - - const std::string& Evaluate(cmLocalGenerator*, const std::string&, - cmGeneratorTarget const*, - cmGeneratorExpressionDAGChecker*, - std::string const&) const override - { - return this->PropertyValue.Value; - } - - cmListFileBacktrace GetBacktrace() const override - { - return this->PropertyValue.Backtrace; - } - std::string const& GetInput() const override - { - return this->PropertyValue.Value; - } - -private: - BT<std::string> PropertyValue; -}; - -class TargetPropertyEntryGenex : public cmGeneratorTarget::TargetPropertyEntry -{ -public: - TargetPropertyEntryGenex(std::unique_ptr<cmCompiledGeneratorExpression> cge, - cmLinkImplItem const& item = NoLinkImplItem) - : cmGeneratorTarget::TargetPropertyEntry(item) - , ge(std::move(cge)) - { - } - - const std::string& Evaluate(cmLocalGenerator* lg, const std::string& config, - cmGeneratorTarget const* headTarget, - cmGeneratorExpressionDAGChecker* dagChecker, - std::string const& language) const override - { - return this->ge->Evaluate(lg, config, headTarget, dagChecker, nullptr, - language); - } - - cmListFileBacktrace GetBacktrace() const override - { - return this->ge->GetBacktrace(); - } - - std::string const& GetInput() const override { return this->ge->GetInput(); } - - bool GetHadContextSensitiveCondition() const override - { - return this->ge->GetHadContextSensitiveCondition(); - } - -private: - const std::unique_ptr<cmCompiledGeneratorExpression> ge; -}; - -class TargetPropertyEntryFileSet - : public cmGeneratorTarget::TargetPropertyEntry -{ -public: - TargetPropertyEntryFileSet( - std::vector<std::string> dirs, bool contextSensitiveDirs, - std::unique_ptr<cmCompiledGeneratorExpression> entryCge, - const cmFileSet* fileSet, cmLinkImplItem const& item = NoLinkImplItem) - : cmGeneratorTarget::TargetPropertyEntry(item) - , BaseDirs(std::move(dirs)) - , ContextSensitiveDirs(contextSensitiveDirs) - , EntryCge(std::move(entryCge)) - , FileSet(fileSet) - { - } - - const std::string& Evaluate(cmLocalGenerator* lg, const std::string& config, - cmGeneratorTarget const* headTarget, - cmGeneratorExpressionDAGChecker* dagChecker, - std::string const& /*lang*/) const override - { - std::map<std::string, std::vector<std::string>> filesPerDir; - this->FileSet->EvaluateFileEntry(this->BaseDirs, filesPerDir, - this->EntryCge, lg, config, headTarget, - dagChecker); - - std::vector<std::string> files; - for (auto const& it : filesPerDir) { - files.insert(files.end(), it.second.begin(), it.second.end()); - } - - static std::string filesStr; - filesStr = cmList::to_string(files); - return filesStr; - } - - cmListFileBacktrace GetBacktrace() const override - { - return this->EntryCge->GetBacktrace(); - } - - std::string const& GetInput() const override - { - return this->EntryCge->GetInput(); - } - - bool GetHadContextSensitiveCondition() const override - { - return this->ContextSensitiveDirs || - this->EntryCge->GetHadContextSensitiveCondition(); - } - -private: - const std::vector<std::string> BaseDirs; - const bool ContextSensitiveDirs; - const std::unique_ptr<cmCompiledGeneratorExpression> EntryCge; - const cmFileSet* FileSet; -}; - -std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry> -cmGeneratorTarget::TargetPropertyEntry::Create( - cmake& cmakeInstance, const BT<std::string>& propertyValue, - bool evaluateForBuildsystem) -{ - if (cmGeneratorExpression::Find(propertyValue.Value) != std::string::npos) { - cmGeneratorExpression ge(cmakeInstance, propertyValue.Backtrace); - std::unique_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(propertyValue.Value); - cge->SetEvaluateForBuildsystem(evaluateForBuildsystem); - return std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>( - cm::make_unique<TargetPropertyEntryGenex>(std::move(cge))); - } - - return std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>( - cm::make_unique<TargetPropertyEntryString>(propertyValue)); -} - -std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry> -cmGeneratorTarget::TargetPropertyEntry::CreateFileSet( - std::vector<std::string> dirs, bool contextSensitiveDirs, - std::unique_ptr<cmCompiledGeneratorExpression> entryCge, - const cmFileSet* fileSet, cmLinkImplItem const& item) -{ - return cm::make_unique<TargetPropertyEntryFileSet>( - std::move(dirs), contextSensitiveDirs, std::move(entryCge), fileSet, item); -} - -cmGeneratorTarget::TargetPropertyEntry::TargetPropertyEntry( - cmLinkImplItem const& item) - : LinkImplItem(item) -{ -} - -bool cmGeneratorTarget::TargetPropertyEntry::GetHadContextSensitiveCondition() - const -{ - return false; -} - static void CreatePropertyGeneratorExpressions( cmake& cmakeInstance, cmBTStringRange entries, std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>>& items, |