cmInstallTargetGenerator.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #include "cmGeneratorTarget.h"
  15. /** \class cmInstallTargetGenerator
  16. * \brief Generate target installation rules.
  17. */
  18. class cmInstallTargetGenerator: public cmInstallGenerator
  19. {
  20. public:
  21. cmInstallTargetGenerator(
  22. cmTarget& t, const char* dest, bool implib,
  23. const char* file_permissions,
  24. std::vector<std::string> const& configurations,
  25. const char* component,
  26. MessageLevel message,
  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(cmTarget const* target,
  49. const std::string& config,
  50. NameType nameType = NameNormal);
  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. cmTarget* Target;
  90. bool ImportLibrary;
  91. std::string FilePermissions;
  92. bool Optional;
  93. NamelinkModeType NamelinkMode;
  94. cmGeneratorTarget* GeneratorTarget;
  95. };
  96. #endif