cmInstallTargetGenerator.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmInstallTargetGenerator_h
  14. #define cmInstallTargetGenerator_h
  15. #include "cmInstallGenerator.h"
  16. #include "cmTarget.h"
  17. /** \class cmInstallTargetGenerator
  18. * \brief Generate target installation rules.
  19. */
  20. class cmInstallTargetGenerator: public cmInstallGenerator
  21. {
  22. public:
  23. cmInstallTargetGenerator(
  24. cmTarget& t, const char* dest, bool implib,
  25. const char* file_permissions = "",
  26. std::vector<std::string> const& configurations
  27. = std::vector<std::string>(),
  28. const char* component = "",
  29. bool optional = false
  30. );
  31. virtual ~cmInstallTargetGenerator();
  32. /** Select the policy for installing shared library linkable name
  33. symlinks. */
  34. enum NamelinkModeType
  35. {
  36. NamelinkModeNone,
  37. NamelinkModeOnly,
  38. NamelinkModeSkip
  39. };
  40. void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; }
  41. NamelinkModeType GetNamelinkMode() const { return this->NamelinkMode; }
  42. std::string GetInstallFilename(const char* config) const;
  43. enum NameType
  44. {
  45. NameNormal,
  46. NameImplib,
  47. NameSO,
  48. NameReal
  49. };
  50. static std::string GetInstallFilename(cmTarget*target, const char* config,
  51. NameType nameType = NameNormal);
  52. cmTarget* GetTarget() const { return this->Target; }
  53. bool IsImportLibrary() const { return this->ImportLibrary; }
  54. protected:
  55. typedef cmInstallGeneratorIndent Indent;
  56. virtual void GenerateScript(std::ostream& os);
  57. void GenerateScriptForConfig(std::ostream& os,
  58. const char* fromDir,
  59. const char* config,
  60. Indent const& indent);
  61. void GenerateScriptForConfigDir(std::ostream& os,
  62. const char* fromDirConfig,
  63. const char* config,
  64. Indent const& indent);
  65. void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
  66. const char* config,
  67. const std::string& toDestDirPath);
  68. void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
  69. const char* config,
  70. std::string const& toDestDirPath);
  71. void AddStripRule(std::ostream& os, Indent const& indent,
  72. cmTarget::TargetType type,
  73. const std::string& toDestDirPath);
  74. void AddRanlibRule(std::ostream& os, Indent const& indent,
  75. cmTarget::TargetType type,
  76. const std::string& toDestDirPath);
  77. cmTarget* Target;
  78. bool ImportLibrary;
  79. std::string FilePermissions;
  80. bool Optional;
  81. NamelinkModeType NamelinkMode;
  82. };
  83. #endif