cmLinkItem.h 3.6 KB

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