cmInstallTargetGenerator.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 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 cmInstallTargetGenerator_h
  11. #define cmInstallTargetGenerator_h
  12. #include "cmInstallGenerator.h"
  13. class cmGeneratorTarget;
  14. /** \class cmInstallTargetGenerator
  15. * \brief Generate target installation rules.
  16. */
  17. class cmInstallTargetGenerator: public cmInstallGenerator
  18. {
  19. public:
  20. cmInstallTargetGenerator(
  21. std::string const& targetName, const char* dest, bool implib,
  22. const char* file_permissions,
  23. std::vector<std::string> const& configurations,
  24. const char* component,
  25. MessageLevel message,
  26. bool exclude_from_all,
  27. bool optional
  28. );
  29. virtual ~cmInstallTargetGenerator();
  30. /** Select the policy for installing shared library linkable name
  31. symlinks. */
  32. enum NamelinkModeType
  33. {
  34. NamelinkModeNone,
  35. NamelinkModeOnly,
  36. NamelinkModeSkip
  37. };
  38. void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; }
  39. NamelinkModeType GetNamelinkMode() const { return this->NamelinkMode; }
  40. std::string GetInstallFilename(const std::string& config) const;
  41. enum NameType
  42. {
  43. NameNormal,
  44. NameImplib,
  45. NameSO,
  46. NameReal
  47. };
  48. static std::string GetInstallFilename(const cmGeneratorTarget* target,
  49. const std::string& config,
  50. NameType nameType = NameNormal);
  51. void Compute(cmLocalGenerator* lg);
  52. cmGeneratorTarget* GetTarget() const { return this->Target; }
  53. bool IsImportLibrary() const { return this->ImportLibrary; }
  54. std::string GetDestination(std::string const& config) const;
  55. protected:
  56. virtual void GenerateScript(std::ostream& os);
  57. virtual void GenerateScriptForConfig(std::ostream& os,
  58. const std::string& config,
  59. Indent const& indent);
  60. typedef void (cmInstallTargetGenerator::*TweakMethod)(
  61. std::ostream&, Indent const&, const std::string&, std::string const&
  62. );
  63. void AddTweak(std::ostream& os, Indent const& indent,
  64. const std::string& config, std::string const& file,
  65. TweakMethod tweak);
  66. void AddTweak(std::ostream& os, Indent const& indent,
  67. const std::string& config,
  68. std::vector<std::string> const& files,
  69. TweakMethod tweak);
  70. std::string GetDestDirPath(std::string const& file);
  71. void PreReplacementTweaks(std::ostream& os, Indent const& indent,
  72. const std::string& config,
  73. std::string const& file);
  74. void PostReplacementTweaks(std::ostream& os, Indent const& indent,
  75. const std::string& config,
  76. std::string const& file);
  77. void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
  78. const std::string& config,
  79. const std::string& toDestDirPath);
  80. void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
  81. const std::string& config,
  82. std::string const& toDestDirPath);
  83. void AddRPathCheckRule(std::ostream& os, Indent const& indent,
  84. const std::string& config,
  85. std::string const& toDestDirPath);
  86. void AddStripRule(std::ostream& os, Indent const& indent,
  87. const std::string& toDestDirPath);
  88. void AddRanlibRule(std::ostream& os, Indent const& indent,
  89. const std::string& toDestDirPath);
  90. void AddUniversalInstallRule(std::ostream& os, Indent const& indent,
  91. const std::string& toDestDirPath);
  92. std::string TargetName;
  93. cmGeneratorTarget* Target;
  94. std::string FilePermissions;
  95. NamelinkModeType NamelinkMode;
  96. bool ImportLibrary;
  97. bool Optional;
  98. };
  99. #endif