cmInstallTargetGenerator.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #include "cmTarget.h"
  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 optional
  27. );
  28. virtual ~cmInstallTargetGenerator();
  29. /** Select the policy for installing shared library linkable name
  30. symlinks. */
  31. enum NamelinkModeType
  32. {
  33. NamelinkModeNone,
  34. NamelinkModeOnly,
  35. NamelinkModeSkip
  36. };
  37. void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; }
  38. NamelinkModeType GetNamelinkMode() const { return this->NamelinkMode; }
  39. std::string GetInstallFilename(const std::string& config) const;
  40. enum NameType
  41. {
  42. NameNormal,
  43. NameImplib,
  44. NameSO,
  45. NameReal
  46. };
  47. static std::string GetInstallFilename(cmTarget const* target,
  48. const std::string& config,
  49. NameType nameType = NameNormal);
  50. void Compute(cmLocalGenerator* lg);
  51. cmTarget* GetTarget() const { return this->Target; }
  52. bool IsImportLibrary() const { return this->ImportLibrary; }
  53. std::string GetDestination(std::string const& config) const;
  54. protected:
  55. virtual void GenerateScript(std::ostream& os);
  56. virtual void GenerateScriptForConfig(std::ostream& os,
  57. const std::string& config,
  58. Indent const& indent);
  59. typedef void (cmInstallTargetGenerator::*TweakMethod)(
  60. std::ostream&, Indent const&, const std::string&, std::string const&
  61. );
  62. void AddTweak(std::ostream& os, Indent const& indent,
  63. const std::string& config, std::string const& file,
  64. TweakMethod tweak);
  65. void AddTweak(std::ostream& os, Indent const& indent,
  66. const std::string& config,
  67. std::vector<std::string> const& files,
  68. TweakMethod tweak);
  69. std::string GetDestDirPath(std::string const& file);
  70. void PreReplacementTweaks(std::ostream& os, Indent const& indent,
  71. const std::string& config,
  72. std::string const& file);
  73. void PostReplacementTweaks(std::ostream& os, Indent const& indent,
  74. const std::string& config,
  75. std::string const& file);
  76. void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
  77. const std::string& config,
  78. const std::string& toDestDirPath);
  79. void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
  80. const std::string& config,
  81. std::string const& toDestDirPath);
  82. void AddRPathCheckRule(std::ostream& os, Indent const& indent,
  83. const std::string& config,
  84. std::string const& toDestDirPath);
  85. void AddStripRule(std::ostream& os, Indent const& indent,
  86. const std::string& toDestDirPath);
  87. void AddRanlibRule(std::ostream& os, Indent const& indent,
  88. const std::string& toDestDirPath);
  89. std::string TargetName;
  90. cmTarget* Target;
  91. std::string FilePermissions;
  92. NamelinkModeType NamelinkMode;
  93. bool ImportLibrary;
  94. bool Optional;
  95. };
  96. #endif