cmInstallGenerator.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmInstallGenerator_h
  4. #define cmInstallGenerator_h
  5. #include <cmConfigure.h>
  6. #include "cmInstallType.h"
  7. #include "cmScriptGenerator.h"
  8. #include <iosfwd>
  9. #include <string>
  10. #include <vector>
  11. class cmLocalGenerator;
  12. class cmMakefile;
  13. /** \class cmInstallGenerator
  14. * \brief Support class for generating install scripts.
  15. *
  16. */
  17. class cmInstallGenerator : public cmScriptGenerator
  18. {
  19. public:
  20. enum MessageLevel
  21. {
  22. MessageDefault,
  23. MessageAlways,
  24. MessageLazy,
  25. MessageNever
  26. };
  27. cmInstallGenerator(const char* destination,
  28. std::vector<std::string> const& configurations,
  29. const char* component, MessageLevel message,
  30. bool exclude_from_all);
  31. ~cmInstallGenerator() CM_OVERRIDE;
  32. void AddInstallRule(
  33. std::ostream& os, std::string const& dest, cmInstallType type,
  34. std::vector<std::string> const& files, bool optional = false,
  35. const char* permissions_file = CM_NULLPTR,
  36. const char* permissions_dir = CM_NULLPTR, const char* rename = CM_NULLPTR,
  37. const char* literal_args = CM_NULLPTR, Indent const& indent = Indent());
  38. /** Get the install destination as it should appear in the
  39. installation script. */
  40. std::string ConvertToAbsoluteDestination(std::string const& dest) const;
  41. /** Test if this generator installs something for a given configuration. */
  42. bool InstallsForConfig(const std::string& config);
  43. /** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */
  44. static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false);
  45. virtual void Compute(cmLocalGenerator*) {}
  46. protected:
  47. void GenerateScript(std::ostream& os) CM_OVERRIDE;
  48. std::string CreateComponentTest(const char* component,
  49. bool exclude_from_all);
  50. // Information shared by most generator types.
  51. std::string Destination;
  52. std::string Component;
  53. MessageLevel Message;
  54. bool ExcludeFromAll;
  55. };
  56. #endif