1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmInstallGenerator.h,v $
6 Date: $Date: 2007-07-02 18:56:57 $
7 Version: $Revision: 1.12 $
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
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
)
36 cmInstallGeneratorIndent
Next(int step
= 2) const
38 return cmInstallGeneratorIndent(this->Level
+ step
);
43 inline std::ostream
& operator<<(std::ostream
& os
,
44 cmInstallGeneratorIndent
const& indent
)
50 /** \class cmInstallGenerator
51 * \brief Support class for generating install scripts.
54 class cmInstallGenerator
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 static void AddInstallRule(
66 std::ostream
& os
, const char* dest
, 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 typedef cmInstallGeneratorIndent Indent
;
83 virtual void GenerateScript(std::ostream
& os
);
84 virtual void GenerateScriptConfigs(std::ostream
& os
, Indent
const& indent
);
85 virtual void GenerateScriptActions(std::ostream
& os
, Indent
const& indent
);
87 std::string
CreateConfigTest(const char* config
);
88 std::string
CreateConfigTest(std::vector
<std::string
> const& configs
);
89 std::string
CreateComponentTest(const char* component
);
91 // Information shared by most generator types.
92 std::string Destination
;
93 std::vector
<std::string
> const Configurations
;
94 std::string Component
;
96 // Information used during generation.
97 const char* ConfigurationName
;
98 std::vector
<std::string
> const* ConfigurationTypes
;