1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackGenerator.h,v $
6 Date: $Date: 2007/11/06 13:28:26 $
7 Version: $Revision: 1.2 $
9 Copyright (c) 2002 Kitware, Inc. 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 =========================================================================*/
18 #ifndef cmCPackGenerator_h
19 #define cmCPackGenerator_h
23 #define cmCPackTypeMacro(class, superclass) \
24 cmTypeMacro(class, superclass); \
25 static cmCPackGenerator* CreateGenerator() { return new class; }
27 #define cmCPackLogger(logType, msg) \
29 cmOStringStream cmCPackLog_msg; \
30 cmCPackLog_msg << msg; \
31 this->Logger->Log(logType, __FILE__, __LINE__,\
32 cmCPackLog_msg.str().c_str());\
38 #define cerr no_cerr_use_cmCPack_Log
43 #define cout no_cout_use_cmCPack_Log
48 /** \class cmCPackGenerator
49 * \brief A superclass of all CPack Generators
52 class cmCPackGenerator
: public cmObject
55 cmTypeMacro(cmCPackGenerator
, cmObject
);
57 * If verbose then more informaiton is printed out
59 void SetVerbose(bool val
) { this->GeneratorVerbose
= val
; }
62 * Do the actual processing. Subclass has to override it.
65 virtual int DoPackage();
68 * Initialize generator
70 int Initialize(const char* name
, cmMakefile
* mf
, const char* argv0
);
76 virtual ~cmCPackGenerator();
78 //! Set and get the options
79 void SetOption(const char* op
, const char* value
);
80 void SetOptionIfNotSet(const char* op
, const char* value
);
81 const char* GetOption(const char* op
);
82 bool IsSet(const char* name
) const;
84 //! Set all the variables
85 int FindRunningCMake(const char* arg0
);
88 void SetLogger(cmCPackLog
* log
) { this->Logger
= log
; }
90 //! Display verbose information via logger
91 void DisplayVerboseOutput(const char* msg
, float progress
);
93 bool ReadListFile(const char* moduleName
);
98 int CleanTemporaryDirectory();
99 virtual const char* GetOutputExtension() { return ".cpack"; }
100 virtual const char* GetOutputPostfix() { return 0; }
101 virtual int CompressFiles(const char* outFileName
, const char* toplevel
,
102 const std::vector
<std::string
>& files
);
103 virtual const char* GetInstallPath();
104 virtual const char* GetPackagingInstallPrefix();
106 virtual std::string
FindTemplate(const char* name
);
107 virtual bool ConfigureFile(const char* inName
, const char* outName
,
108 bool copyOnly
= false);
109 virtual bool ConfigureString(const std::string
& input
, std::string
& output
);
110 virtual int InitializeInternal();
113 //! Run install commands if specified
114 virtual int InstallProjectViaInstallCommands(
115 bool setDestDir
, const char* tempInstallDirectory
);
116 virtual int InstallProjectViaInstallScript(
117 bool setDestDir
, const char* tempInstallDirectory
);
118 virtual int InstallProjectViaInstalledDirectories(
119 bool setDestDir
, const char* tempInstallDirectory
);
120 virtual int InstallProjectViaInstallCMakeProjects(
121 bool setDestDir
, const char* tempInstallDirectory
);
123 bool GeneratorVerbose
;
126 std::string InstallPath
;
128 std::string CPackSelf
;
129 std::string CMakeSelf
;
130 std::string CMakeRoot
;
134 cmMakefile
* MakefileMap
;