packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmInstallFilesCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmInstallFilesCommand_h
13 #define cmInstallFilesCommand_h
14
15 #include "cmCommand.h"
16
17 /** \class cmInstallFilesCommand
18  * \brief Specifies where to install some files
19  *
20  * cmInstallFilesCommand specifies the relative path where a list of
21  * files should be installed.
22  */
23 class cmInstallFilesCommand : public cmCommand
24 {
25 public:
26   /**
27    * This is a virtual constructor for the command.
28    */
29   virtual cmCommand* Clone()
30     {
31     return new cmInstallFilesCommand;
32     }
33
34   /**
35    * This is called when the command is first encountered in
36    * the CMakeLists.txt file.
37    */
38   virtual bool InitialPass(std::vector<std::string> const& args,
39                            cmExecutionStatus &status);
40
41   /**
42    * The name of the command as specified in CMakeList.txt.
43    */
44   virtual const char* GetName() const { return "install_files";}
45
46   /**
47    * Succinct documentation.
48    */
49   virtual const char* GetTerseDocumentation() const
50     {
51     return "Deprecated.  Use the install(FILES ) command instead.";
52     }
53
54   /**
55    * This is called at the end after all the information
56    * specified by the command is accumulated. Most commands do
57    * not implement this method.  At this point, reading and
58    * writing to the cache can be done.
59    */
60   virtual void FinalPass();
61   virtual bool HasFinalPass() const { return !this->IsFilesForm; }
62
63   /**
64    * More documentation.
65    */
66   virtual const char* GetFullDocumentation() const
67     {
68     return
69       "This command has been superceded by the install command.  It "
70       "is provided for compatibility with older CMake code.  "
71       "The FILES form is directly replaced by the FILES form of the "
72       "install command.  The regexp form can be expressed "
73       "more clearly using the GLOB form of the file command.\n"
74       "  install_files(<dir> extension file file ...)\n"
75       "Create rules to install the listed files with the given extension "
76       "into the given directory.  "
77       "Only files existing in the current source tree or its corresponding "
78       "location in the binary tree may be listed.  "
79       "If a file specified already has an extension, that extension will be "
80       "removed first.  This is useful for providing lists of source files "
81       "such as foo.cxx when you want the corresponding foo.h to be "
82       "installed. A typical extension is '.h'.\n"
83       "  install_files(<dir> regexp)\n"
84       "Any files in the current source directory that match the regular "
85       "expression will be installed.\n"
86       "  install_files(<dir> FILES file file ...)\n"
87       "Any files listed after the FILES keyword will be "
88       "installed explicitly from the names given.  Full paths are allowed in "
89       "this form.\n"
90       "The directory <dir> is relative to the installation prefix, which "
91       "is stored in the variable CMAKE_INSTALL_PREFIX.";
92     }
93
94   /** This command is kept for compatibility with older CMake versions. */
95   virtual bool IsDiscouraged() const
96     {
97     return true;
98     }
99
100   cmTypeMacro(cmInstallFilesCommand, cmCommand);
101
102 protected:
103   void CreateInstallGenerator() const;
104   std::string FindInstallSource(const char* name) const;
105
106  private:
107   std::vector<std::string> FinalArgs;
108   bool IsFilesForm;
109   std::string Destination;
110   std::vector<std::string> Files;
111 };
112
113
114 #endif