cmInstallGenerator.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 cmInstallGenerator_h
  11. #define cmInstallGenerator_h
  12. #include "cmInstallType.h"
  13. #include "cmScriptGenerator.h"
  14. class cmLocalGenerator;
  15. class cmMakefile;
  16. /** \class cmInstallGenerator
  17. * \brief Support class for generating install scripts.
  18. *
  19. */
  20. class cmInstallGenerator: public cmScriptGenerator
  21. {
  22. public:
  23. enum MessageLevel
  24. {
  25. MessageDefault,
  26. MessageAlways,
  27. MessageLazy,
  28. MessageNever
  29. };
  30. cmInstallGenerator(const char* destination,
  31. std::vector<std::string> const& configurations,
  32. const char* component,
  33. MessageLevel message);
  34. virtual ~cmInstallGenerator();
  35. void AddInstallRule(
  36. std::ostream& os, cmInstallType type,
  37. std::vector<std::string> const& files,
  38. bool optional = false,
  39. const char* permissions_file = 0,
  40. const char* permissions_dir = 0,
  41. const char* rename = 0,
  42. const char* literal_args = 0,
  43. Indent const& indent = Indent()
  44. );
  45. const char* GetDestination() const
  46. { return this->Destination.c_str(); }
  47. /** Get the install destination as it should appear in the
  48. installation script. */
  49. std::string GetInstallDestination() const;
  50. /** Test if this generator installs something for a given configuration. */
  51. bool InstallsForConfig(const std::string& config);
  52. /** Select message level from CMAKE_INSTALL_MESSAGE. */
  53. static MessageLevel SelectMessageLevel(cmMakefile* mf);
  54. protected:
  55. virtual void GenerateScript(std::ostream& os);
  56. std::string CreateComponentTest(const char* component);
  57. // Information shared by most generator types.
  58. std::string Destination;
  59. std::string Component;
  60. MessageLevel Message;
  61. };
  62. #endif