Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmInstallGenerator.h
blobb2dfee50a351b217bbf1da5370096cc528ea2d60
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmInstallGenerator.h,v $
5 Language: C++
6 Date: $Date: 2008/01/28 13:38:35 $
7 Version: $Revision: 1.13 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmInstallGenerator_h
18 #define cmInstallGenerator_h
20 #include "cmStandardIncludes.h"
22 class cmLocalGenerator;
24 class cmInstallGeneratorIndent
26 public:
27 cmInstallGeneratorIndent(): Level(0) {}
28 cmInstallGeneratorIndent(int level): Level(level) {}
29 void Write(std::ostream& os) const
31 for(int i=0; i < this->Level; ++i)
33 os << " ";
36 cmInstallGeneratorIndent Next(int step = 2) const
38 return cmInstallGeneratorIndent(this->Level + step);
40 private:
41 int Level;
43 inline std::ostream& operator<<(std::ostream& os,
44 cmInstallGeneratorIndent const& indent)
46 indent.Write(os);
47 return os;
50 /** \class cmInstallGenerator
51 * \brief Support class for generating install scripts.
54 class cmInstallGenerator
56 public:
57 cmInstallGenerator(const char* destination,
58 std::vector<std::string> const& configurations,
59 const char* component);
60 virtual ~cmInstallGenerator();
62 void Generate(std::ostream& os, const char* config,
63 std::vector<std::string> const& configurationTypes);
65 void AddInstallRule(
66 std::ostream& os, int type,
67 std::vector<std::string> const& files,
68 bool optional = false,
69 const char* properties = 0,
70 const char* permissions_file = 0,
71 const char* permissions_dir = 0,
72 const char* rename = 0,
73 const char* literal_args = 0,
74 cmInstallGeneratorIndent const& indent = cmInstallGeneratorIndent()
77 const char* GetDestination() const
78 { return this->Destination.c_str(); }
79 const std::vector<std::string>& GetConfigurations() const
80 { return this->Configurations; }
82 /** Get the install destination as it should appear in the
83 installation script. */
84 std::string GetInstallDestination() const;
86 /** Test if this generator installs something for a given configuration. */
87 bool InstallsForConfig(const char*);
89 protected:
90 typedef cmInstallGeneratorIndent Indent;
91 virtual void GenerateScript(std::ostream& os);
92 virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
93 virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
95 std::string CreateConfigTest(const char* config);
96 std::string CreateConfigTest(std::vector<std::string> const& configs);
97 std::string CreateComponentTest(const char* component);
99 // Information shared by most generator types.
100 std::string Destination;
101 std::vector<std::string> const Configurations;
102 std::string Component;
104 // Information used during generation.
105 const char* ConfigurationName;
106 std::vector<std::string> const* ConfigurationTypes;
109 #endif