cmLinkItem.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2004-2015 Kitware, Inc.
  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 cmLinkItem_h
  11. #define cmLinkItem_h
  12. #include "cmListFileCache.h"
  13. class cmTarget;
  14. // Basic information about each link item.
  15. class cmLinkItem: public std::string
  16. {
  17. typedef std::string std_string;
  18. public:
  19. cmLinkItem(): std_string(), Target(0) {}
  20. cmLinkItem(const std_string& n,
  21. cmTarget const* t): std_string(n), Target(t) {}
  22. cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {}
  23. cmTarget const* Target;
  24. };
  25. class cmLinkImplItem: public cmLinkItem
  26. {
  27. public:
  28. cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {}
  29. cmLinkImplItem(std::string const& n,
  30. cmTarget const* t,
  31. cmListFileBacktrace const& bt,
  32. bool fromGenex):
  33. cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {}
  34. cmLinkImplItem(cmLinkImplItem const& r):
  35. cmLinkItem(r), Backtrace(r.Backtrace), FromGenex(r.FromGenex) {}
  36. cmListFileBacktrace Backtrace;
  37. bool FromGenex;
  38. };
  39. /** The link implementation specifies the direct library
  40. dependencies needed by the object files of the target. */
  41. struct cmLinkImplementationLibraries
  42. {
  43. // Libraries linked directly in this configuration.
  44. std::vector<cmLinkImplItem> Libraries;
  45. // Libraries linked directly in other configurations.
  46. // Needed only for OLD behavior of CMP0003.
  47. std::vector<cmLinkItem> WrongConfigLibraries;
  48. };
  49. struct cmLinkInterfaceLibraries
  50. {
  51. // Libraries listed in the interface.
  52. std::vector<cmLinkItem> Libraries;
  53. };
  54. struct cmLinkInterface: public cmLinkInterfaceLibraries
  55. {
  56. // Languages whose runtime libraries must be linked.
  57. std::vector<std::string> Languages;
  58. // Shared library dependencies needed for linking on some platforms.
  59. std::vector<cmLinkItem> SharedDeps;
  60. // Number of repetitions of a strongly connected component of two
  61. // or more static libraries.
  62. int Multiplicity;
  63. // Libraries listed for other configurations.
  64. // Needed only for OLD behavior of CMP0003.
  65. std::vector<cmLinkItem> WrongConfigLibraries;
  66. bool ImplementationIsInterface;
  67. cmLinkInterface(): Multiplicity(0), ImplementationIsInterface(false) {}
  68. };
  69. struct cmOptionalLinkInterface: public cmLinkInterface
  70. {
  71. cmOptionalLinkInterface():
  72. LibrariesDone(false), AllDone(false),
  73. Exists(false), HadHeadSensitiveCondition(false),
  74. ExplicitLibraries(0) {}
  75. bool LibrariesDone;
  76. bool AllDone;
  77. bool Exists;
  78. bool HadHeadSensitiveCondition;
  79. const char* ExplicitLibraries;
  80. };
  81. struct cmHeadToLinkInterfaceMap:
  82. public std::map<cmTarget const*, cmOptionalLinkInterface>
  83. {
  84. };
  85. struct cmLinkImplementation: public cmLinkImplementationLibraries
  86. {
  87. // Languages whose runtime libraries must be linked.
  88. std::vector<std::string> Languages;
  89. };
  90. // Cache link implementation computation from each configuration.
  91. struct cmOptionalLinkImplementation: public cmLinkImplementation
  92. {
  93. cmOptionalLinkImplementation():
  94. LibrariesDone(false), LanguagesDone(false),
  95. HadHeadSensitiveCondition(false) {}
  96. bool LibrariesDone;
  97. bool LanguagesDone;
  98. bool HadHeadSensitiveCondition;
  99. };
  100. #endif