cmCommonTargetGenerator.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCommonTargetGenerator_h
  11. #define cmCommonTargetGenerator_h
  12. #include "cmStandardIncludes.h"
  13. #include "cmLocalGenerator.h"
  14. class cmGeneratorTarget;
  15. class cmGlobalCommonGenerator;
  16. class cmLocalCommonGenerator;
  17. class cmMakefile;
  18. class cmSourceFile;
  19. /** \class cmCommonTargetGenerator
  20. * \brief Common infrastructure for Makefile and Ninja per-target generators
  21. */
  22. class cmCommonTargetGenerator
  23. {
  24. public:
  25. cmCommonTargetGenerator(cmGeneratorTarget* gt);
  26. virtual ~cmCommonTargetGenerator();
  27. std::string const& GetConfigName() const;
  28. protected:
  29. // Add language feature flags.
  30. void AddFeatureFlags(std::string& flags, const std::string& lang);
  31. // Feature query methods.
  32. const char* GetFeature(const std::string& feature);
  33. bool GetFeatureAsBool(const std::string& feature);
  34. // Helper to add flag for windows .def file.
  35. void AddModuleDefinitionFlag(std::string& flags);
  36. cmGeneratorTarget* GeneratorTarget;
  37. cmMakefile* Makefile;
  38. cmLocalCommonGenerator* LocalGenerator;
  39. cmGlobalCommonGenerator* GlobalGenerator;
  40. std::string ConfigName;
  41. // The windows module definition source file (.def), if any.
  42. cmSourceFile const* ModuleDefinitionFile;
  43. std::string Convert(
  44. std::string const& source, cmOutputConverter::RelativeRoot relative,
  45. cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED);
  46. void AppendFortranFormatFlags(std::string& flags,
  47. cmSourceFile const& source);
  48. virtual void AddIncludeFlags(std::string& flags,
  49. std::string const& lang) = 0;
  50. void AppendOSXVerFlag(std::string& flags, const std::string& lang,
  51. const char* name, bool so);
  52. typedef std::map<std::string, std::string> ByLanguageMap;
  53. std::string GetFlags(const std::string& l);
  54. ByLanguageMap FlagsByLanguage;
  55. std::string GetDefines(const std::string& l);
  56. ByLanguageMap DefinesByLanguage;
  57. std::string GetIncludes(std::string const& l);
  58. ByLanguageMap IncludesByLanguage;
  59. std::string GetManifests();
  60. std::vector<std::string> GetLinkedTargetDirectories() const;
  61. };
  62. #endif