cmInstallTargetGenerator.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. std::string GetInstallFilename(const char* config) const;
  42. static std::string GetInstallFilename(cmTarget*target, const char* config,
  43. bool implib, bool useSOName);
  44. cmTarget* GetTarget() const { return this->Target; }
  45. bool IsImportLibrary() const { return this->ImportLibrary; }
  46. protected:
  47. typedef cmInstallGeneratorIndent Indent;
  48. virtual void GenerateScript(std::ostream& os);
  49. void GenerateScriptForConfig(std::ostream& os,
  50. const char* fromDir,
  51. const char* config,
  52. Indent const& indent);
  53. void GenerateScriptForConfigDir(std::ostream& os,
  54. const char* fromDirConfig,
  55. const char* config,
  56. Indent const& indent);
  57. void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
  58. const char* config,
  59. const std::string& toDestDirPath);
  60. void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
  61. const char* config,
  62. std::string const& toDestDirPath);
  63. void AddStripRule(std::ostream& os, Indent const& indent,
  64. cmTarget::TargetType type,
  65. const std::string& toDestDirPath);
  66. void AddRanlibRule(std::ostream& os, Indent const& indent,
  67. cmTarget::TargetType type,
  68. const std::string& toDestDirPath);
  69. cmTarget* Target;
  70. bool ImportLibrary;
  71. std::string FilePermissions;
  72. bool Optional;
  73. NamelinkModeType NamelinkMode;
  74. };
  75. #endif