cmRulePlaceholderExpander.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmRulePlaceholderExpander_h
  4. #define cmRulePlaceholderExpander_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <map>
  7. #include <string>
  8. class cmOutputConverter;
  9. class cmRulePlaceholderExpander
  10. {
  11. public:
  12. cmRulePlaceholderExpander(
  13. std::map<std::string, std::string> const& compilers,
  14. std::map<std::string, std::string> const& variableMappings,
  15. std::string const& compilerSysroot, std::string const& linkerSysroot);
  16. void SetTargetImpLib(std::string const& targetImpLib)
  17. {
  18. this->TargetImpLib = targetImpLib;
  19. }
  20. // Create a struct to hold the varibles passed into
  21. // ExpandRuleVariables
  22. struct RuleVariables
  23. {
  24. RuleVariables();
  25. const char* CMTargetName;
  26. const char* CMTargetType;
  27. const char* TargetPDB;
  28. const char* TargetCompilePDB;
  29. const char* TargetVersionMajor;
  30. const char* TargetVersionMinor;
  31. const char* Language;
  32. const char* Objects;
  33. const char* Target;
  34. const char* LinkLibraries;
  35. const char* Source;
  36. const char* AssemblySource;
  37. const char* PreprocessedSource;
  38. const char* Output;
  39. const char* Object;
  40. const char* ObjectDir;
  41. const char* ObjectFileDir;
  42. const char* Flags;
  43. const char* ObjectsQuoted;
  44. const char* SONameFlag;
  45. const char* TargetSOName;
  46. const char* TargetInstallNameDir;
  47. const char* LinkFlags;
  48. const char* Manifests;
  49. const char* LanguageCompileFlags;
  50. const char* Defines;
  51. const char* Includes;
  52. const char* DependencyFile;
  53. const char* FilterPrefix;
  54. };
  55. // Expand rule variables in CMake of the type found in language rules
  56. void ExpandRuleVariables(cmOutputConverter* outputConverter,
  57. std::string& string,
  58. const RuleVariables& replaceValues);
  59. // Expand rule variables in a single string
  60. std::string ExpandRuleVariable(cmOutputConverter* outputConverter,
  61. std::string const& variable,
  62. const RuleVariables& replaceValues);
  63. private:
  64. std::string TargetImpLib;
  65. std::map<std::string, std::string> Compilers;
  66. std::map<std::string, std::string> VariableMappings;
  67. std::string CompilerSysroot;
  68. std::string LinkerSysroot;
  69. };
  70. #endif