summaryrefslogtreecommitdiff
path: root/Source/CPack/cmCPackGenerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack/cmCPackGenerator.h')
-rw-r--r--Source/CPack/cmCPackGenerator.h143
1 files changed, 64 insertions, 79 deletions
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 8fafef93d..45777fa05 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -1,66 +1,38 @@
-/*============================================================================
- CMake - Cross Platform Makefile Generator
- Copyright 2000-2009 Kitware, Inc.
-
- Distributed under the OSI-approved BSD License (the "License");
- see accompanying file Copyright.txt for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License for more information.
-============================================================================*/
-
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackGenerator_h
#define cmCPackGenerator_h
-#include "cmObject.h"
-#include "cmSystemTools.h"
+#include "cmConfigure.h"
+
#include <map>
+#include <sstream>
+#include <string>
#include <vector>
-#include "cmCPackComponentGroup.h" // cmCPackComponent and friends
- // Forward declarations are insufficient since we use them in
- // std::map data members below...
-
-#define cmCPackTypeMacro(class, superclass) \
- cmTypeMacro(class, superclass); \
- static cmCPackGenerator* CreateGenerator() { return new class; }
-
-#define cmCPackLogger(logType, msg) \
- do { \
- cmOStringStream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- this->Logger->Log(logType, __FILE__, __LINE__,\
- cmCPackLog_msg.str().c_str());\
- } while ( 0 )
-
-#ifdef cerr
-# undef cerr
-#endif
-#define cerr no_cerr_use_cmCPack_Log
-
-#ifdef cout
-# undef cout
-#endif
-#define cout no_cout_use_cmCPack_Log
+#include "cmCPackComponentGroup.h"
+#include "cmSystemTools.h"
-class cmMakefile;
class cmCPackLog;
+class cmInstalledFile;
+class cmMakefile;
/** \class cmCPackGenerator
* \brief A superclass of all CPack Generators
*
*/
-class cmCPackGenerator : public cmObject
+class cmCPackGenerator
{
public:
- cmTypeMacro(cmCPackGenerator, cmObject);
+ virtual const char* GetNameOfClass() = 0;
/**
* If verbose then more information is printed out
*/
void SetVerbose(bool val)
- { this->GeneratorVerbose = val ?
- cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
+ {
+ this->GeneratorVerbose =
+ val ? cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE;
+ }
/**
* Returns true if the generator may work on this system.
@@ -90,7 +62,7 @@ public:
/**
* Initialize generator
*/
- int Initialize(const char* name, cmMakefile* mf);
+ int Initialize(const std::string& name, cmMakefile* mf);
/**
* Construct generator
@@ -99,14 +71,14 @@ public:
virtual ~cmCPackGenerator();
//! Set and get the options
- void SetOption(const char* op, const char* value);
- void SetOptionIfNotSet(const char* op, const char* value);
- const char* GetOption(const char* op) const;
- bool IsSet(const char* name) const;
- bool IsOn(const char* name) const;
-
- //! Set all the variables
- int SetCMakeRoot();
+ void SetOption(const std::string& op, const char* value);
+ void SetOptionIfNotSet(const std::string& op, const char* value);
+ const char* GetOption(const std::string& op) const;
+ std::vector<std::string> GetOptions() const;
+ bool IsSet(const std::string& name) const;
+ bool IsOn(const std::string& name) const;
+ bool IsSetToOff(const std::string& op) const;
+ bool IsSetToEmpty(const std::string& op) const;
//! Set the logger
void SetLogger(cmCPackLog* log) { this->Logger = log; }
@@ -130,8 +102,10 @@ protected:
int CleanTemporaryDirectory();
+ cmInstalledFile const* GetInstalledFile(std::string const& name) const;
+
virtual const char* GetOutputExtension() { return ".cpack"; }
- virtual const char* GetOutputPostfix() { return 0; }
+ virtual const char* GetOutputPostfix() { return CM_NULLPTR; }
/**
* Prepare requested grouping kind from CPACK_xxx vars
@@ -154,25 +128,25 @@ protected:
* default is "componentName"
*/
virtual std::string GetComponentInstallDirNameSuffix(
- const std::string& componentName);
+ const std::string& componentName);
/**
* CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME
* with CPACK_COMPONENT_xxxx_<NAME>_DISPLAY_NAME if
* CPACK_<GEN>_USE_DISPLAY_NAME_IN_FILENAME is ON.
- * @param[in] initialPackageFileName
- * @param[in] groupOrComponentName
- * @param[in] isGroupName
+ * @param[in] initialPackageFileName the initial package name to be mangled
+ * @param[in] groupOrComponentName the name of the group/component
+ * @param[in] isGroupName true if previous name refers to a group,
+ * false otherwise
*/
virtual std::string GetComponentPackageFileName(
- const std::string& initialPackageFileName,
- const std::string& groupOrComponentName,
- bool isGroupName);
+ const std::string& initialPackageFileName,
+ const std::string& groupOrComponentName, bool isGroupName);
/**
* Package the list of files and/or components which
* has been prepared by the beginning of DoPackage.
- * @pre @ref toplevel has been filled-in
+ * @pre the @ref toplevel has been filled-in
* @pre the list of file @ref files has been populated
* @pre packageFileNames contains at least 1 entry
* @post packageFileNames may have been updated and contains
@@ -184,26 +158,26 @@ protected:
virtual std::string FindTemplate(const char* name);
virtual bool ConfigureFile(const char* inName, const char* outName,
- bool copyOnly = false);
+ bool copyOnly = false);
virtual bool ConfigureString(const std::string& input, std::string& output);
virtual int InitializeInternal();
-
//! Run install commands if specified
virtual int InstallProjectViaInstallCommands(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
virtual int InstallProjectViaInstallScript(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
virtual int InstallProjectViaInstalledDirectories(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
virtual int InstallProjectViaInstallCMakeProjects(
- bool setDestDir, const char* tempInstallDirectory);
+ bool setDestDir, const std::string& tempInstallDirectory);
/**
* The various level of support of
* CPACK_SET_DESTDIR used by the generator.
*/
- enum CPackSetDestdirSupport {
+ enum CPackSetDestdirSupport
+ {
/* the generator works with or without it */
SETDESTDIR_SUPPORTED,
/* the generator works best if automatically handled */
@@ -246,12 +220,12 @@ protected:
* @return true if component installation is supported and wanted.
*/
virtual bool WantsComponentInstallation() const;
- virtual cmCPackInstallationType* GetInstallationType(const char *projectName,
- const char* name);
- virtual cmCPackComponent* GetComponent(const char *projectName,
- const char* name);
- virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName,
- const char* name);
+ virtual cmCPackInstallationType* GetInstallationType(
+ const std::string& projectName, const std::string& name);
+ virtual cmCPackComponent* GetComponent(const std::string& projectName,
+ const std::string& name);
+ virtual cmCPackComponentGroup* GetComponentGroup(
+ const std::string& projectName, const std::string& name);
cmSystemTools::OutputOption GeneratorVerbose;
std::string Name;
@@ -284,10 +258,6 @@ protected:
*/
std::vector<std::string> files;
- std::string CPackSelf;
- std::string CMakeSelf;
- std::string CMakeRoot;
-
std::map<std::string, cmCPackInstallationType> InstallationTypes;
/**
* The set of components.
@@ -322,8 +292,23 @@ protected:
ComponentPackageMethod componentPackageMethod;
cmCPackLog* Logger;
+
private:
cmMakefile* MakefileMap;
};
+#define cmCPackTypeMacro(klass, superclass) \
+ typedef superclass Superclass; \
+ const char* GetNameOfClass() CM_OVERRIDE { return #klass; } \
+ static cmCPackGenerator* CreateGenerator() { return new klass; } \
+ class cmCPackTypeMacro_UseTrailingSemicolon
+
+#define cmCPackLogger(logType, msg) \
+ do { \
+ std::ostringstream cmCPackLog_msg; \
+ cmCPackLog_msg << msg; \
+ this->Logger->Log(logType, __FILE__, __LINE__, \
+ cmCPackLog_msg.str().c_str()); \
+ } while (false)
+
#endif