cmTestGenerator.h 1.77 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 cmTestGenerator_h
#define cmTestGenerator_h

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

8 9
#include "cmScriptGenerator.h"

10 11 12 13
#include <iosfwd>
#include <string>
#include <vector>

14
class cmGeneratorExpression;
15
class cmLocalGenerator;
16
class cmTest;
17 18 19 20 21

/** \class cmTestGenerator
 * \brief Support class for generating install scripts.
 *
 */
22
class cmTestGenerator : public cmScriptGenerator
23 24 25
{
public:
  cmTestGenerator(cmTest* test,
26 27
                  std::vector<std::string> const& configurations =
                    std::vector<std::string>());
28
  ~cmTestGenerator() override;
29

wahikihiki's avatar
wahikihiki committed
30 31 32
  cmTestGenerator(cmTestGenerator const&) = delete;
  cmTestGenerator& operator=(cmTestGenerator const&) = delete;

33 34
  void Compute(cmLocalGenerator* lg);

35 36 37 38 39
  /** Test if this generator installs the test for a given configuration.  */
  bool TestsForConfig(const std::string& config);

  cmTest* GetTest() const;

40 41
private:
  void GenerateInternalProperties(std::ostream& os);
42 43 44
  std::vector<std::string> EvaluateCommandLineArguments(
    const std::vector<std::string>& argv, cmGeneratorExpression& ge,
    const std::string& config) const;
45

46
protected:
47 48
  void GenerateScriptConfigs(std::ostream& os, Indent indent) override;
  void GenerateScriptActions(std::ostream& os, Indent indent) override;
49
  void GenerateScriptForConfig(std::ostream& os, const std::string& config,
50 51 52
                               Indent indent) override;
  void GenerateScriptNoConfig(std::ostream& os, Indent indent) override;
  bool NeedsScriptNoConfig() const override;
53
  void GenerateOldStyle(std::ostream& os, Indent indent);
54

55
  cmLocalGenerator* LG;
56 57 58 59 60
  cmTest* Test;
  bool TestGenerated;
};

#endif