cmCommonTargetGenerator.h 2.17 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 cmCommonTargetGenerator_h
#define cmCommonTargetGenerator_h

6
7
8
9
#include <cmConfigure.h> // IWYU pragma: keep
#include <map>
#include <string>
#include <vector>
10

11
12
class cmGeneratorTarget;
class cmGlobalCommonGenerator;
13
class cmLinkLineComputer;
14
15
class cmLocalCommonGenerator;
class cmMakefile;
16
class cmSourceFile;
17

18
19
20
21
22
23
/** \class cmCommonTargetGenerator
 * \brief Common infrastructure for Makefile and Ninja per-target generators
 */
class cmCommonTargetGenerator
{
public:
24
  cmCommonTargetGenerator(cmGeneratorTarget* gt);
25
  virtual ~cmCommonTargetGenerator();
26

27
28
  std::string const& GetConfigName() const;

29
protected:
30
31
32
33
34
35
36
  // Add language feature flags.
  void AddFeatureFlags(std::string& flags, const std::string& lang);

  // Feature query methods.
  const char* GetFeature(const std::string& feature);
  bool GetFeatureAsBool(const std::string& feature);

37
  // Helper to add flag for windows .def file.
38
39
  void AddModuleDefinitionFlag(cmLinkLineComputer* linkLineComputer,
                               std::string& flags);
40

41
42
43
44
  cmGeneratorTarget* GeneratorTarget;
  cmMakefile* Makefile;
  cmLocalCommonGenerator* LocalGenerator;
  cmGlobalCommonGenerator* GlobalGenerator;
45
  std::string ConfigName;
46
47

  // The windows module definition source file (.def), if any.
Tim Grothe's avatar
Tim Grothe committed
48
  cmSourceFile const* ModuleDefinitionFile;
49

50
51
  void AppendFortranFormatFlags(std::string& flags,
                                cmSourceFile const& source);
52

53
54
55
  virtual void AddIncludeFlags(std::string& flags,
                               std::string const& lang) = 0;

56
57
58
  void AppendOSXVerFlag(std::string& flags, const std::string& lang,
                        const char* name, bool so);

59
  typedef std::map<std::string, std::string> ByLanguageMap;
60
  std::string GetFlags(const std::string& l);
61
  ByLanguageMap FlagsByLanguage;
62
  std::string GetDefines(const std::string& l);
63
  ByLanguageMap DefinesByLanguage;
64
65
  std::string GetIncludes(std::string const& l);
  ByLanguageMap IncludesByLanguage;
66
  std::string GetManifests();
67
68

  std::vector<std::string> GetLinkedTargetDirectories() const;
69
70
71
};

#endif