cmInstallFilesCommand.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 cmInstallFilesCommand_h
  11. #define cmInstallFilesCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmInstallFilesCommand
  14. * \brief Specifies where to install some files
  15. *
  16. * cmInstallFilesCommand specifies the relative path where a list of
  17. * files should be installed.
  18. */
  19. class cmInstallFilesCommand : public cmCommand
  20. {
  21. public:
  22. /**
  23. * This is a virtual constructor for the command.
  24. */
  25. virtual cmCommand* Clone()
  26. {
  27. return new cmInstallFilesCommand;
  28. }
  29. /**
  30. * This is called when the command is first encountered in
  31. * the CMakeLists.txt file.
  32. */
  33. virtual bool InitialPass(std::vector<std::string> const& args,
  34. cmExecutionStatus &status);
  35. /**
  36. * The name of the command as specified in CMakeList.txt.
  37. */
  38. virtual const char* GetName() { return "install_files";}
  39. /**
  40. * Succinct documentation.
  41. */
  42. virtual const char* GetTerseDocumentation()
  43. {
  44. return "Deprecated. Use the install(FILES ) command instead.";
  45. }
  46. /**
  47. * This is called at the end after all the information
  48. * specified by the command is accumulated. Most commands do
  49. * not implement this method. At this point, reading and
  50. * writing to the cache can be done.
  51. */
  52. virtual void FinalPass();
  53. virtual bool HasFinalPass() const { return !this->IsFilesForm; }
  54. /**
  55. * More documentation.
  56. */
  57. virtual const char* GetFullDocumentation()
  58. {
  59. return
  60. "This command has been superceded by the install command. It "
  61. "is provided for compatibility with older CMake code. "
  62. "The FILES form is directly replaced by the FILES form of the "
  63. "install command. The regexp form can be expressed "
  64. "more clearly using the GLOB form of the file command.\n"
  65. " install_files(<dir> extension file file ...)\n"
  66. "Create rules to install the listed files with the given extension "
  67. "into the given directory. "
  68. "Only files existing in the current source tree or its corresponding "
  69. "location in the binary tree may be listed. "
  70. "If a file specified already has an extension, that extension will be "
  71. "removed first. This is useful for providing lists of source files "
  72. "such as foo.cxx when you want the corresponding foo.h to be "
  73. "installed. A typical extension is '.h'.\n"
  74. " install_files(<dir> regexp)\n"
  75. "Any files in the current source directory that match the regular "
  76. "expression will be installed.\n"
  77. " install_files(<dir> FILES file file ...)\n"
  78. "Any files listed after the FILES keyword will be "
  79. "installed explicitly from the names given. Full paths are allowed in "
  80. "this form.\n"
  81. "The directory <dir> is relative to the installation prefix, which "
  82. "is stored in the variable CMAKE_INSTALL_PREFIX.";
  83. }
  84. /** This command is kept for compatibility with older CMake versions. */
  85. virtual bool IsDiscouraged()
  86. {
  87. return true;
  88. }
  89. cmTypeMacro(cmInstallFilesCommand, cmCommand);
  90. protected:
  91. void CreateInstallGenerator() const;
  92. std::string FindInstallSource(const char* name) const;
  93. private:
  94. std::vector<std::string> FinalArgs;
  95. bool IsFilesForm;
  96. std::string Destination;
  97. std::vector<std::string> Files;
  98. };
  99. #endif