blob: 9b30e8cb2607bc7c22446699ac621dfb6155d437 [file]
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file LICENSE.rst or https://cmake.org/licensing for details. */
#pragma once
#include "cmConfigure.h" // IWYU pragma: keep
#include <memory>
#include <string>
#include "cmPropertyMap.h"
#include "cmRule.h"
#include "cmRuleHelper.h"
#include "cmValue.h"
class cmMakefile;
class cmTarget;
class cmFileSet;
class cmSourceFile;
class cmCustomCommand;
class cmGeneratorRule
{
public:
cmGeneratorRule(cmRule const* rule, cmTarget const* target,
cmFileSet const* fileSet, cmFileSet const* outputFileSet,
cmSourceFile const* source,
cm::RulePatternSet const& patterns);
cmGeneratorRule(cmGeneratorRule const&) = delete;
cmGeneratorRule& operator=(cmGeneratorRule const&) = delete;
cmMakefile& GetMakefile() const { return this->Makefile; }
/** Get the name of the rule */
std::string const& GetName() const { return this->Name; }
cmRule const* GetRule() const { return this->Rule; }
cmTarget const* GetTarget() const { return this->Target; }
bool IsGloballyVisible() const { return this->Rule->IsGloballyVisible(); }
cmValue GetProperty(std::string const& property) const;
std::unique_ptr<cmCustomCommand> Generate(cmFileSet* outFileSet) const;
private:
void UpdateRuleExpander(cm::RulePatternSet const& patterns);
std::unique_ptr<cmCustomCommand> CreateCustomCommand() const;
std::string Name;
cmRule const* Rule;
cmTarget const* Target;
cmFileSet const* FileSet;
cmFileSet const* OutputFileSet;
cmSourceFile const* Source;
cmMakefile& Makefile;
mutable cmPropertyMap Properties;
static cm::RulePatternSet const DefaultProperties;
cm::RulePatternSet Patterns;
mutable cm::RulePatternPlaceholderExpander RuleExpander;
};