cmGeneratorExpressionEvaluationFile.h 1.69 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3 4 5
#ifndef cmGeneratorExpressionEvaluationFile_h
#define cmGeneratorExpressionEvaluationFile_h

6
#include "cmConfigure.h" // IWYU pragma: keep
7 8

#include <map>
9
#include <memory> // IWYU pragma: keep
10 11
#include <string>
#include <vector>
12

13
#include "cmGeneratorExpression.h"
14
#include "cmPolicies.h"
15
#include "cm_sys_stat.h"
16

17 18
class cmLocalGenerator;

19 20 21
class cmGeneratorExpressionEvaluationFile
{
public:
22
  cmGeneratorExpressionEvaluationFile(
wahikihiki's avatar
wahikihiki committed
23
    std::string input,
24 25 26
    std::unique_ptr<cmCompiledGeneratorExpression> outputFileExpr,
    std::unique_ptr<cmCompiledGeneratorExpression> condition,
    bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070);
27

28
  void Generate(cmLocalGenerator* lg);
29 30 31

  std::vector<std::string> GetFiles() const { return this->Files; }

32
  void CreateOutputFile(cmLocalGenerator* lg, std::string const& config);
33

34
private:
35 36 37
  void Generate(cmLocalGenerator* lg, const std::string& config,
                const std::string& lang,
                cmCompiledGeneratorExpression* inputExpression,
38
                std::map<std::string, std::string>& outputFiles, mode_t perm);
39

40 41 42 43 44 45 46 47
  enum PathRole
  {
    PathForInput,
    PathForOutput
  };
  std::string FixRelativePath(std::string const& filePath, PathRole role,
                              cmLocalGenerator* lg);

48 49
private:
  const std::string Input;
50 51
  const std::unique_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
  const std::unique_ptr<cmCompiledGeneratorExpression> Condition;
52 53
  std::vector<std::string> Files;
  const bool InputIsContent;
54
  cmPolicies::PolicyStatus PolicyStatusCMP0070;
55 56 57
};

#endif