cmInstallTargetGenerator.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. = std::vector<std::string>(),
  26. const char* component = "Unspecified",
  27. bool optional = false
  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 char* 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 char* config,
  50. NameType nameType = NameNormal);
  51. cmTarget* GetTarget() const { return this->Target; }
  52. bool IsImportLibrary() const { return this->ImportLibrary; }
  53. protected:
  54. virtual void GenerateScript(std::ostream& os);
  55. virtual void GenerateScriptForConfig(std::ostream& os,
  56. const char* config,
  57. Indent const& indent);
  58. typedef void (cmInstallTargetGenerator::*TweakMethod)(
  59. std::ostream&, Indent const&, const char*, std::string const&
  60. );
  61. void AddTweak(std::ostream& os, Indent const& indent,
  62. const char* config, std::string const& file,
  63. TweakMethod tweak);
  64. void AddTweak(std::ostream& os, Indent const& indent,
  65. const char* config, std::vector<std::string> const& files,
  66. TweakMethod tweak);
  67. std::string GetDestDirPath(std::string const& file);
  68. void PreReplacementTweaks(std::ostream& os, Indent const& indent,
  69. const char* config, std::string const& file);
  70. void PostReplacementTweaks(std::ostream& os, Indent const& indent,
  71. const char* config, std::string const& file);
  72. void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
  73. const char* config,
  74. const std::string& toDestDirPath);
  75. void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
  76. const char* config,
  77. std::string const& toDestDirPath);
  78. void AddRPathCheckRule(std::ostream& os, Indent const& indent,
  79. const char* config,
  80. std::string const& toDestDirPath);
  81. void AddStripRule(std::ostream& os, Indent const& indent,
  82. const std::string& toDestDirPath);
  83. void AddRanlibRule(std::ostream& os, Indent const& indent,
  84. const std::string& toDestDirPath);
  85. cmTarget* Target;
  86. bool ImportLibrary;
  87. std::string FilePermissions;
  88. bool Optional;
  89. NamelinkModeType NamelinkMode;
  90. cmGeneratorTarget* GeneratorTarget;
  91. };
  92. #endif