summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.cxx137
-rw-r--r--Source/CPack/IFW/cmCPackIFWCommon.h81
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx340
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h34
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx388
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h19
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx531
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h27
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx220
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.h18
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx9
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx56
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h6
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.h4
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx14
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h2
-rw-r--r--Source/CPack/WiX/cmWIXPatch.cxx8
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx30
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h10
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx2
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.h4
-rw-r--r--Source/CPack/WiX/cmWIXShortcut.h2
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.cxx4
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.h4
-rw-r--r--Source/CPack/cmCPack7zGenerator.h2
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx10
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h2
-rw-r--r--Source/CPack/cmCPackBundleGenerator.h3
-rw-r--r--Source/CPack/cmCPackComponentGroup.h6
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackDebGenerator.h2
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx49
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx24
-rw-r--r--Source/CPack/cmCPackGenerator.h31
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx2
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h2
-rw-r--r--Source/CPack/cmCPackLog.cxx2
-rw-r--r--Source/CPack/cmCPackLog.h2
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h2
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx2
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.h3
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h3
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h2
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx21
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.h3
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h2
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx7
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h2
-rw-r--r--Source/CPack/cmCPackTGZGenerator.h2
-rw-r--r--Source/CPack/cmCPackTXZGenerator.h2
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.h2
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.h2
-rw-r--r--Source/CPack/cmCPackZIPGenerator.h2
-rw-r--r--Source/CPack/cpack.cxx12
63 files changed, 1130 insertions, 1059 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
new file mode 100644
index 0000000..e8f05bd
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -0,0 +1,137 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCPackIFWCommon.h"
+
+#include "cmCPackGenerator.h"
+#include "cmCPackIFWGenerator.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
+#include "cmSystemTools.h"
+#include "cmTimestamp.h"
+#include "cmVersionConfig.h"
+#include "cmXMLWriter.h"
+
+#include <sstream>
+#include <utility>
+#include <vector>
+
+cmCPackIFWCommon::cmCPackIFWCommon()
+ : Generator(CM_NULLPTR)
+{
+}
+
+const char* cmCPackIFWCommon::GetOption(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::GetOption(op)
+ : CM_NULLPTR;
+}
+
+bool cmCPackIFWCommon::IsOn(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::IsOn(op) : false;
+}
+
+bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::IsSetToOff(op)
+ : false;
+}
+
+bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
+{
+ return this->Generator ? this->Generator->cmCPackGenerator::IsSetToEmpty(op)
+ : false;
+}
+
+bool cmCPackIFWCommon::IsVersionLess(const char* version)
+{
+ if (!this->Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->Generator->FrameworkVersion.data(), version);
+}
+
+bool cmCPackIFWCommon::IsVersionGreater(const char* version)
+{
+ if (!this->Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_GREATER, this->Generator->FrameworkVersion.data(),
+ version);
+}
+
+bool cmCPackIFWCommon::IsVersionEqual(const char* version)
+{
+ if (!this->Generator) {
+ return false;
+ }
+
+ return cmSystemTools::VersionCompare(
+ cmSystemTools::OP_EQUAL, this->Generator->FrameworkVersion.data(),
+ version);
+}
+
+void cmCPackIFWCommon::ExpandListArgument(
+ const std::string& arg, std::map<std::string, std::string>& argsOut)
+{
+ std::vector<std::string> args;
+ cmSystemTools::ExpandListArgument(arg, args, false);
+ if (args.empty()) {
+ return;
+ }
+
+ std::size_t i = 0;
+ std::size_t c = args.size();
+ if (c % 2) {
+ argsOut[""] = args[i];
+ ++i;
+ }
+
+ --c;
+ for (; i < c; i += 2) {
+ argsOut[args[i]] = args[i + 1];
+ }
+}
+
+void cmCPackIFWCommon::ExpandListArgument(
+ const std::string& arg, std::multimap<std::string, std::string>& argsOut)
+{
+ std::vector<std::string> args;
+ cmSystemTools::ExpandListArgument(arg, args, false);
+ if (args.empty()) {
+ return;
+ }
+
+ std::size_t i = 0;
+ std::size_t c = args.size();
+ if (c % 2) {
+ argsOut.insert(std::pair<std::string, std::string>("", args[i]));
+ ++i;
+ }
+
+ --c;
+ for (; i < c; i += 2) {
+ argsOut.insert(std::pair<std::string, std::string>(args[i], args[i + 1]));
+ }
+}
+
+void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout)
+{
+ if (!this->Generator) {
+ return;
+ }
+
+ std::ostringstream comment;
+ comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
+ << "for QtIFW ";
+ if (this->IsVersionEqual("1.9.9")) {
+ comment << "less 2.0";
+ } else {
+ comment << this->Generator->FrameworkVersion;
+ }
+ comment << " tools at " << cmTimestamp().CurrentTime("", true);
+ xout.Comment(comment.str().c_str());
+}
diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h
new file mode 100644
index 0000000..354d849
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWCommon.h
@@ -0,0 +1,81 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmCPackIFWCommon_h
+#define cmCPackIFWCommon_h
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <map>
+#include <string>
+
+class cmCPackIFWGenerator;
+class cmXMLWriter;
+
+/** \class cmCPackIFWCommon
+ * \brief A base class for CPack IFW generator implementation subclasses
+ */
+class cmCPackIFWCommon
+{
+public:
+ // Constructor
+
+ /**
+ * Construct Part
+ */
+ cmCPackIFWCommon();
+
+public:
+ // Internal implementation
+
+ const char* GetOption(const std::string& op) const;
+ bool IsOn(const std::string& op) const;
+ bool IsSetToOff(const std::string& op) const;
+ bool IsSetToEmpty(const std::string& op) const;
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionLess(const char* version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionGreater(const char* version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionEqual(const char* version);
+
+ /** Expand the list argument containing the map of the key-value pairs.
+ * If the number of elements is odd, then the first value is used as the
+ * default value with an empty key.
+ * Any values with the same keys will be permanently overwritten.
+ */
+ static void ExpandListArgument(const std::string& arg,
+ std::map<std::string, std::string>& argsOut);
+
+ /** Expand the list argument containing the multimap of the key-value pairs.
+ * If the number of elements is odd, then the first value is used as the
+ * default value with an empty key.
+ */
+ static void ExpandListArgument(
+ const std::string& arg, std::multimap<std::string, std::string>& argsOut);
+
+ cmCPackIFWGenerator* Generator;
+
+protected:
+ void WriteGeneratedByToStrim(cmXMLWriter& xout);
+};
+
+#define cmCPackIFWLogger(logType, msg) \
+ do { \
+ std::ostringstream cmCPackLog_msg; \
+ cmCPackLog_msg << msg; \
+ if (Generator) { \
+ Generator->Logger->Log(cmCPackLog::LOG_##logType, __FILE__, __LINE__, \
+ cmCPackLog_msg.str().c_str()); \
+ } \
+ } while (false)
+
+#endif // cmCPackIFWCommon_h
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index ee46d86..226ea0a 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -2,94 +2,76 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWGenerator.h"
-#include "CPack/cmCPackComponentGroup.h"
-#include "CPack/cmCPackGenerator.h"
-#include "CPack/cmCPackLog.h"
+#include "cmCPackComponentGroup.h"
+#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
-#include "cmTimestamp.h"
-#include "cmVersionConfig.h"
-#include "cmXMLWriter.h"
#include <sstream>
#include <utility>
cmCPackIFWGenerator::cmCPackIFWGenerator()
{
+ this->Generator = this;
}
cmCPackIFWGenerator::~cmCPackIFWGenerator()
{
}
-bool cmCPackIFWGenerator::IsVersionLess(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
- FrameworkVersion.data(), version);
-}
-
-bool cmCPackIFWGenerator::IsVersionGreater(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER,
- FrameworkVersion.data(), version);
-}
-
-bool cmCPackIFWGenerator::IsVersionEqual(const char* version)
-{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
- FrameworkVersion.data(), version);
-}
-
int cmCPackIFWGenerator::PackageFiles()
{
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Configuration" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Configuration" << std::endl);
// Installer configuragion
- Installer.GenerateInstallerFile();
+ this->Installer.GenerateInstallerFile();
// Packages configuration
- Installer.GeneratePackageFiles();
+ this->Installer.GeneratePackageFiles();
std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string ifwTmpFile = ifwTLD;
ifwTmpFile += "/IFWOutput.log";
// Run repogen
- if (!Installer.RemoteRepositories.empty()) {
- std::string ifwCmd = RepoGen;
+ if (!this->Installer.RemoteRepositories.empty()) {
+ std::string ifwCmd = this->RepoGen;
- if (IsVersionLess("2.0.0")) {
+ if (this->IsVersionLess("2.0.0")) {
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
}
ifwCmd += " -p " + this->toplevel + "/packages";
- if (!PkgsDirsVector.empty()) {
- for (std::vector<std::string>::iterator it = PkgsDirsVector.begin();
- it != PkgsDirsVector.end(); ++it) {
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::vector<std::string>::iterator it =
+ this->PkgsDirsVector.begin();
+ it != this->PkgsDirsVector.end(); ++it) {
ifwCmd += " -p " + *it;
}
}
- if (!OnlineOnly && !DownloadedPackages.empty()) {
+ if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
ifwCmd += " -i ";
- std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
+ std::set<cmCPackIFWPackage*>::iterator it =
+ this->DownloadedPackages.begin();
ifwCmd += (*it)->Name;
++it;
- while (it != DownloadedPackages.end()) {
+ while (it != this->DownloadedPackages.end()) {
ifwCmd += "," + (*it)->Name;
++it;
}
}
ifwCmd += " " + this->toplevel + "/repository";
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd << std::endl);
+ cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl);
std::string output;
int retVal = 1;
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate repository"
- << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
&output, &retVal, CM_NULLPTR,
this->GeneratorVerbose, 0);
@@ -98,36 +80,39 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
- << ifwCmd << std::endl
- << "Please check " << ifwTmpFile << " for errors"
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Problem running IFW command: "
+ << ifwCmd << std::endl
+ << "Please check " << ifwTmpFile << " for errors"
+ << std::endl);
return 0;
}
- if (!Repository.RepositoryUpdate.empty() &&
- !Repository.PatchUpdatesXml()) {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Problem patch IFW \"Updates\" "
- << "file: " << this->toplevel + "/repository/Updates.xml"
- << std::endl);
+ if (!this->Repository.RepositoryUpdate.empty() &&
+ !this->Repository.PatchUpdatesXml()) {
+ cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" "
+ << "file: "
+ << this->toplevel + "/repository/Updates.xml"
+ << std::endl);
}
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- repository: "
- << this->toplevel << "/repository generated" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- repository: " << this->toplevel
+ << "/repository generated"
+ << std::endl);
}
// Run binary creator
{
- std::string ifwCmd = BinCreator;
+ std::string ifwCmd = this->BinCreator;
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
- if (!Installer.Resources.empty()) {
+ if (!this->Installer.Resources.empty()) {
ifwCmd += " -r ";
- std::vector<std::string>::iterator it = Installer.Resources.begin();
+ std::vector<std::string>::iterator it =
+ this->Installer.Resources.begin();
std::string path = this->toplevel + "/resources/";
ifwCmd += path + *it;
++it;
- while (it != Installer.Resources.end()) {
+ while (it != this->Installer.Resources.end()) {
ifwCmd += "," + path + *it;
++it;
}
@@ -135,52 +120,55 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " -p " + this->toplevel + "/packages";
- if (!PkgsDirsVector.empty()) {
- for (std::vector<std::string>::iterator it = PkgsDirsVector.begin();
- it != PkgsDirsVector.end(); ++it) {
+ if (!this->PkgsDirsVector.empty()) {
+ for (std::vector<std::string>::iterator it =
+ this->PkgsDirsVector.begin();
+ it != this->PkgsDirsVector.end(); ++it) {
ifwCmd += " -p " + *it;
}
}
- if (OnlineOnly) {
+ if (this->OnlineOnly) {
ifwCmd += " --online-only";
- } else if (!DownloadedPackages.empty() &&
- !Installer.RemoteRepositories.empty()) {
+ } else if (!this->DownloadedPackages.empty() &&
+ !this->Installer.RemoteRepositories.empty()) {
ifwCmd += " -e ";
- std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin();
+ std::set<cmCPackIFWPackage*>::iterator it =
+ this->DownloadedPackages.begin();
ifwCmd += (*it)->Name;
++it;
- while (it != DownloadedPackages.end()) {
+ while (it != this->DownloadedPackages.end()) {
ifwCmd += "," + (*it)->Name;
++it;
}
- } else if (!DependentPackages.empty()) {
+ } else if (!this->DependentPackages.empty()) {
ifwCmd += " -i ";
// Binary
- std::set<cmCPackIFWPackage*>::iterator bit = BinaryPackages.begin();
- while (bit != BinaryPackages.end()) {
+ std::set<cmCPackIFWPackage*>::iterator bit =
+ this->BinaryPackages.begin();
+ while (bit != this->BinaryPackages.end()) {
ifwCmd += (*bit)->Name + ",";
++bit;
}
// Depend
- DependenceMap::iterator it = DependentPackages.begin();
+ DependenceMap::iterator it = this->DependentPackages.begin();
ifwCmd += it->second.Name;
++it;
- while (it != DependentPackages.end()) {
+ while (it != this->DependentPackages.end()) {
ifwCmd += "," + it->second.Name;
++it;
}
}
// TODO: set correct name for multipackages
if (!this->packageFileNames.empty()) {
- ifwCmd += " " + packageFileNames[0];
+ ifwCmd += " " + this->packageFileNames[0];
} else {
ifwCmd += " installer";
}
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd << std::endl);
+ cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl);
std::string output;
int retVal = 1;
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl);
+ cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
&output, &retVal, CM_NULLPTR,
this->GeneratorVerbose, 0);
@@ -189,10 +177,10 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
- << ifwCmd << std::endl
- << "Please check " << ifwTmpFile << " for errors"
- << std::endl);
+ cmCPackIFWLogger(ERROR, "Problem running IFW command: "
+ << ifwCmd << std::endl
+ << "Please check " << ifwTmpFile << " for errors"
+ << std::endl);
return 0;
}
}
@@ -202,12 +190,12 @@ int cmCPackIFWGenerator::PackageFiles()
const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
{
- const char* defPrefix = cmCPackGenerator::GetPackagingInstallPrefix();
+ const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
std::string tmpPref = defPrefix ? defPrefix : "";
if (this->Components.empty()) {
- tmpPref += "packages/" + GetRootPackageName() + "/data";
+ tmpPref += "packages/" + this->GetRootPackageName() + "/data";
}
this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str());
@@ -217,7 +205,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
const char* cmCPackIFWGenerator::GetOutputExtension()
{
- return ExecutableSuffix.c_str();
+ return this->ExecutableSuffix.c_str();
}
int cmCPackIFWGenerator::InitializeInternal()
@@ -237,16 +225,15 @@ int cmCPackIFWGenerator::InitializeInternal()
const char* BinCreatorStr = this->GetOption(BinCreatorOpt);
if (!BinCreatorStr || cmSystemTools::IsNOTFOUND(BinCreatorStr)) {
- BinCreator = "";
+ this->BinCreator = "";
} else {
- BinCreator = BinCreatorStr;
+ this->BinCreator = BinCreatorStr;
}
- if (BinCreator.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find QtIFW compiler \"binarycreator\": "
- "likely it is not installed, or not in your PATH"
- << std::endl);
+ if (this->BinCreator.empty()) {
+ cmCPackIFWLogger(ERROR, "Cannot find QtIFW compiler \"binarycreator\": "
+ "likely it is not installed, or not in your PATH"
+ << std::endl);
return 0;
}
@@ -254,39 +241,40 @@ int cmCPackIFWGenerator::InitializeInternal()
const char* RepoGenStr = this->GetOption(RepoGenOpt);
if (!RepoGenStr || cmSystemTools::IsNOTFOUND(RepoGenStr)) {
- RepoGen = "";
+ this->RepoGen = "";
} else {
- RepoGen = RepoGenStr;
+ this->RepoGen = RepoGenStr;
}
// Framework version
if (const char* FrameworkVersionSrt = this->GetOption(FrameworkVersionOpt)) {
- FrameworkVersion = FrameworkVersionSrt;
+ this->FrameworkVersion = FrameworkVersionSrt;
} else {
- FrameworkVersion = "1.9.9";
+ this->FrameworkVersion = "1.9.9";
}
// Variables that Change Behavior
// Resolve duplicate names
- ResolveDuplicateNames = this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
+ this->ResolveDuplicateNames =
+ this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
// Additional packages dirs
- PkgsDirsVector.clear();
+ this->PkgsDirsVector.clear();
if (const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) {
- cmSystemTools::ExpandListArgument(dirs, PkgsDirsVector);
+ cmSystemTools::ExpandListArgument(dirs, this->PkgsDirsVector);
}
// Installer
- Installer.Generator = this;
- Installer.ConfigureFromOptions();
+ this->Installer.Generator = this;
+ this->Installer.ConfigureFromOptions();
// Repository
- Repository.Generator = this;
- Repository.Name = "Unspecified";
+ this->Repository.Generator = this;
+ this->Repository.Name = "Unspecified";
if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
- Repository.Url = site;
- Installer.RemoteRepositories.push_back(&Repository);
+ this->Repository.Url = site;
+ this->Installer.RemoteRepositories.push_back(&this->Repository);
}
// Repositories
@@ -295,38 +283,38 @@ int cmCPackIFWGenerator::InitializeInternal()
cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
for (std::vector<std::string>::iterator rit = RepoAllVector.begin();
rit != RepoAllVector.end(); ++rit) {
- GetRepository(*rit);
+ this->GetRepository(*rit);
}
}
if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
- OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
+ this->OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
} else if (const char* cpackDownloadAll =
this->GetOption("CPACK_DOWNLOAD_ALL")) {
- OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
+ this->OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
} else {
- OnlineOnly = false;
+ this->OnlineOnly = false;
}
- if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find QtIFW repository generator \"repogen\": "
- "likely it is not installed, or not in your PATH"
- << std::endl);
+ if (!this->Installer.RemoteRepositories.empty() && this->RepoGen.empty()) {
+ cmCPackIFWLogger(ERROR,
+ "Cannot find QtIFW repository generator \"repogen\": "
+ "likely it is not installed, or not in your PATH"
+ << std::endl);
return 0;
}
// Executable suffix
if (const char* optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) {
- ExecutableSuffix = optExeSuffix;
- if (ExecutableSuffix.empty()) {
+ this->ExecutableSuffix = optExeSuffix;
+ if (this->ExecutableSuffix.empty()) {
std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME"));
if (sysName == "Linux") {
- ExecutableSuffix = ".run";
+ this->ExecutableSuffix = ".run";
}
}
} else {
- ExecutableSuffix = cmCPackGenerator::GetOutputExtension();
+ this->ExecutableSuffix = this->cmCPackGenerator::GetOutputExtension();
}
return this->Superclass::InitializeInternal();
@@ -338,52 +326,53 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
const std::string prefix = "packages/";
const std::string suffix = "/data";
- if (componentPackageMethod == ONE_PACKAGE) {
- return std::string(prefix + GetRootPackageName() + suffix);
+ if (this->componentPackageMethod == this->ONE_PACKAGE) {
+ return std::string(prefix + this->GetRootPackageName() + suffix);
}
- return prefix + GetComponentPackageName(&Components[componentName]) + suffix;
+ return prefix +
+ this->GetComponentPackageName(&this->Components[componentName]) + suffix;
}
cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
{
- ComponentsMap::iterator cit = Components.find(componentName);
- if (cit != Components.end()) {
+ ComponentsMap::iterator cit = this->Components.find(componentName);
+ if (cit != this->Components.end()) {
return &(cit->second);
}
cmCPackComponent* component =
- cmCPackGenerator::GetComponent(projectName, componentName);
+ this->cmCPackGenerator::GetComponent(projectName, componentName);
if (!component) {
return component;
}
- std::string name = GetComponentPackageName(component);
- PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end()) {
+ std::string name = this->GetComponentPackageName(component);
+ PackagesMap::iterator pit = this->Packages.find(name);
+ if (pit != this->Packages.end()) {
return component;
}
- cmCPackIFWPackage* package = &Packages[name];
+ cmCPackIFWPackage* package = &this->Packages[name];
package->Name = name;
package->Generator = this;
if (package->ConfigureFromComponent(component)) {
- package->Installer = &Installer;
- Installer.Packages.insert(
+ package->Installer = &this->Installer;
+ this->Installer.Packages.insert(
std::pair<std::string, cmCPackIFWPackage*>(name, package));
- ComponentPackages.insert(
+ this->ComponentPackages.insert(
std::pair<cmCPackComponent*, cmCPackIFWPackage*>(component, package));
if (component->IsDownloaded) {
- DownloadedPackages.insert(package);
+ this->DownloadedPackages.insert(package);
} else {
- BinaryPackages.insert(package);
+ this->BinaryPackages.insert(package);
}
} else {
- Packages.erase(name);
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot configure package \""
- << name << "\" for component \"" << component->Name << "\""
- << std::endl);
+ this->Packages.erase(name);
+ cmCPackIFWLogger(ERROR, "Cannot configure package \""
+ << name << "\" for component \"" << component->Name
+ << "\"" << std::endl);
}
return component;
@@ -393,32 +382,32 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
const std::string& projectName, const std::string& groupName)
{
cmCPackComponentGroup* group =
- cmCPackGenerator::GetComponentGroup(projectName, groupName);
+ this->cmCPackGenerator::GetComponentGroup(projectName, groupName);
if (!group) {
return group;
}
- std::string name = GetGroupPackageName(group);
- PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end()) {
+ std::string name = this->GetGroupPackageName(group);
+ PackagesMap::iterator pit = this->Packages.find(name);
+ if (pit != this->Packages.end()) {
return group;
}
- cmCPackIFWPackage* package = &Packages[name];
+ cmCPackIFWPackage* package = &this->Packages[name];
package->Name = name;
package->Generator = this;
if (package->ConfigureFromGroup(group)) {
- package->Installer = &Installer;
- Installer.Packages.insert(
+ package->Installer = &this->Installer;
+ this->Installer.Packages.insert(
std::pair<std::string, cmCPackIFWPackage*>(name, package));
- GroupPackages.insert(
+ this->GroupPackages.insert(
std::pair<cmCPackComponentGroup*, cmCPackIFWPackage*>(group, package));
- BinaryPackages.insert(package);
+ this->BinaryPackages.insert(package);
} else {
- Packages.erase(name);
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot configure package \""
- << name << "\" for component group \"" << group->Name
- << "\"" << std::endl);
+ this->Packages.erase(name);
+ cmCPackIFWLogger(ERROR, "Cannot configure package \""
+ << name << "\" for component group \"" << group->Name
+ << "\"" << std::endl);
}
return group;
}
@@ -441,7 +430,7 @@ bool cmCPackIFWGenerator::SupportsComponentInstallation() const
bool cmCPackIFWGenerator::IsOnePackage() const
{
- return componentPackageMethod == ONE_PACKAGE;
+ return this->componentPackageMethod == cmCPackGenerator::ONE_PACKAGE;
}
std::string cmCPackIFWGenerator::GetRootPackageName()
@@ -474,16 +463,16 @@ std::string cmCPackIFWGenerator::GetGroupPackageName(
if (!group) {
return name;
}
- if (cmCPackIFWPackage* package = GetGroupPackage(group)) {
+ if (cmCPackIFWPackage* package = this->GetGroupPackage(group)) {
return package->Name;
}
const char* option =
- GetOption("CPACK_IFW_COMPONENT_GROUP_" +
- cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
+ this->GetOption("CPACK_IFW_COMPONENT_GROUP_" +
+ cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
name = option ? option : group->Name;
if (group->ParentGroup) {
- cmCPackIFWPackage* package = GetGroupPackage(group->ParentGroup);
- bool dot = !ResolveDuplicateNames;
+ cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup);
+ bool dot = !this->ResolveDuplicateNames;
if (dot && name.substr(0, package->Name.size()) == package->Name) {
dot = false;
}
@@ -501,20 +490,21 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
if (!component) {
return name;
}
- if (cmCPackIFWPackage* package = GetComponentPackage(component)) {
+ if (cmCPackIFWPackage* package = this->GetComponentPackage(component)) {
return package->Name;
}
std::string prefix = "CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_";
- const char* option = GetOption(prefix + "NAME");
+ const char* option = this->GetOption(prefix + "NAME");
name = option ? option : component->Name;
if (component->Group) {
- cmCPackIFWPackage* package = GetGroupPackage(component->Group);
- if ((componentPackageMethod == ONE_PACKAGE_PER_GROUP) ||
- IsOn(prefix + "COMMON")) {
+ cmCPackIFWPackage* package = this->GetGroupPackage(component->Group);
+ if ((this->componentPackageMethod ==
+ cmCPackGenerator::ONE_PACKAGE_PER_GROUP) ||
+ this->IsOn(prefix + "COMMON")) {
return package->Name;
}
- bool dot = !ResolveDuplicateNames;
+ bool dot = !this->ResolveDuplicateNames;
if (dot && name.substr(0, package->Name.size()) == package->Name) {
dot = false;
}
@@ -529,56 +519,42 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
cmCPackComponentGroup* group) const
{
std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit =
- GroupPackages.find(group);
- return pit != GroupPackages.end() ? pit->second : CM_NULLPTR;
+ this->GroupPackages.find(group);
+ return pit != this->GroupPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
cmCPackComponent* component) const
{
std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit =
- ComponentPackages.find(component);
- return pit != ComponentPackages.end() ? pit->second : CM_NULLPTR;
+ this->ComponentPackages.find(component);
+ return pit != this->ComponentPackages.end() ? pit->second : CM_NULLPTR;
}
cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
{
- RepositoriesMap::iterator rit = Repositories.find(repositoryName);
- if (rit != Repositories.end()) {
+ RepositoriesMap::iterator rit = this->Repositories.find(repositoryName);
+ if (rit != this->Repositories.end()) {
return &(rit->second);
}
- cmCPackIFWRepository* repository = &Repositories[repositoryName];
+ cmCPackIFWRepository* repository = &this->Repositories[repositoryName];
repository->Name = repositoryName;
repository->Generator = this;
if (repository->ConfigureFromOptions()) {
if (repository->Update == cmCPackIFWRepository::None) {
- Installer.RemoteRepositories.push_back(repository);
+ this->Installer.RemoteRepositories.push_back(repository);
} else {
- Repository.RepositoryUpdate.push_back(repository);
+ this->Repository.RepositoryUpdate.push_back(repository);
}
} else {
- Repositories.erase(repositoryName);
+ this->Repositories.erase(repositoryName);
repository = CM_NULLPTR;
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Invalid repository \""
- << repositoryName << "\""
- << " configuration. Repository will be skipped."
- << std::endl);
+ cmCPackIFWLogger(WARNING, "Invalid repository \""
+ << repositoryName << "\""
+ << " configuration. Repository will be skipped."
+ << std::endl);
}
return repository;
}
-
-void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- std::ostringstream comment;
- comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
- << "for QtIFW ";
- if (IsVersionLess("2.0")) {
- comment << "less 2.0";
- } else {
- comment << FrameworkVersion;
- }
- comment << " tools at " << cmTimestamp().CurrentTime("", true);
- xout.Comment(comment.str().c_str());
-}
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index d656063..8348cee 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -3,10 +3,11 @@
#ifndef cmCPackIFWGenerator_h
#define cmCPackIFWGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h" // IWYU pragma: keep
-#include "CPack/cmCPackComponentGroup.h"
-#include "CPack/cmCPackGenerator.h"
+#include "cmCPackComponentGroup.h"
+#include "cmCPackGenerator.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWInstaller.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
@@ -16,14 +17,12 @@
#include <string>
#include <vector>
-class cmXMLWriter;
-
/** \class cmCPackIFWGenerator
* \brief A generator for Qt Installer Framework tools
*
* http://qt-project.org/doc/qtinstallerframework/index.html
*/
-class cmCPackIFWGenerator : public cmCPackGenerator
+class cmCPackIFWGenerator : public cmCPackGenerator, public cmCPackIFWCommon
{
public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
@@ -35,6 +34,11 @@ public:
typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
DependenceMap;
+ using cmCPackIFWCommon::GetOption;
+ using cmCPackIFWCommon::IsOn;
+ using cmCPackIFWCommon::IsSetToOff;
+ using cmCPackIFWCommon::IsSetToEmpty;
+
/**
* Construct IFW generator
*/
@@ -45,21 +49,6 @@ public:
*/
~cmCPackIFWGenerator() CM_OVERRIDE;
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionLess(const char* version);
-
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionGreater(const char* version);
-
- /**
- * Compare \a version with QtIFW framework version
- */
- bool IsVersionEqual(const char* version);
-
protected:
// cmCPackGenerator reimplementation
@@ -124,12 +113,11 @@ protected:
cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
-
protected:
// Data
friend class cmCPackIFWPackage;
+ friend class cmCPackIFWCommon;
friend class cmCPackIFWInstaller;
friend class cmCPackIFWRepository;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index d8bafee..288e924 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -2,69 +2,29 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWInstaller.h"
-#include <cmConfigure.h>
-#include <sstream>
-#include <stddef.h>
-#include <utility>
-
-#include "CPack/cmCPackGenerator.h"
-#include "CPack/cmCPackLog.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWRepository.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
+#include <sstream>
+#include <stddef.h>
+#include <utility>
cmCPackIFWInstaller::cmCPackIFWInstaller()
- : Generator(CM_NULLPTR)
-{
-}
-
-const char* cmCPackIFWInstaller::GetOption(const std::string& op) const
-{
- return Generator ? Generator->GetOption(op) : CM_NULLPTR;
-}
-
-bool cmCPackIFWInstaller::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionGreater(const char* version)
{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWInstaller::IsVersionEqual(const char* version)
-{
- return Generator ? Generator->IsVersionEqual(version) : false;
}
void cmCPackIFWInstaller::printSkippedOptionWarning(
const std::string& optionName, const std::string& optionValue)
{
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "Option "
+ cmCPackIFWLogger(
+ WARNING, "Option "
<< optionName << " is set to \"" << optionValue
<< "\" but will be skipped because the specified file does not exist."
<< std::endl);
@@ -75,198 +35,199 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
// Name;
if (const char* optIFW_PACKAGE_NAME =
this->GetOption("CPACK_IFW_PACKAGE_NAME")) {
- Name = optIFW_PACKAGE_NAME;
+ this->Name = optIFW_PACKAGE_NAME;
} else if (const char* optPACKAGE_NAME =
this->GetOption("CPACK_PACKAGE_NAME")) {
- Name = optPACKAGE_NAME;
+ this->Name = optPACKAGE_NAME;
} else {
- Name = "Your package";
+ this->Name = "Your package";
}
// Title;
if (const char* optIFW_PACKAGE_TITLE =
- GetOption("CPACK_IFW_PACKAGE_TITLE")) {
- Title = optIFW_PACKAGE_TITLE;
+ this->GetOption("CPACK_IFW_PACKAGE_TITLE")) {
+ this->Title = optIFW_PACKAGE_TITLE;
} else if (const char* optPACKAGE_DESCRIPTION_SUMMARY =
- GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) {
- Title = optPACKAGE_DESCRIPTION_SUMMARY;
+ this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) {
+ this->Title = optPACKAGE_DESCRIPTION_SUMMARY;
} else {
- Title = "Your package description";
+ this->Title = "Your package description";
}
// Version;
- if (const char* option = GetOption("CPACK_PACKAGE_VERSION")) {
- Version = option;
+ if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = option;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
// Publisher
if (const char* optIFW_PACKAGE_PUBLISHER =
- GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) {
- Publisher = optIFW_PACKAGE_PUBLISHER;
+ this->GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) {
+ this->Publisher = optIFW_PACKAGE_PUBLISHER;
} else if (const char* optPACKAGE_VENDOR =
GetOption("CPACK_PACKAGE_VENDOR")) {
- Publisher = optPACKAGE_VENDOR;
+ this->Publisher = optPACKAGE_VENDOR;
}
// ProductUrl
- if (const char* option = GetOption("CPACK_IFW_PRODUCT_URL")) {
- ProductUrl = option;
+ if (const char* option = this->GetOption("CPACK_IFW_PRODUCT_URL")) {
+ this->ProductUrl = option;
}
// ApplicationIcon
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_ICON")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) {
if (cmSystemTools::FileExists(option)) {
- InstallerApplicationIcon = option;
+ this->InstallerApplicationIcon = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option);
}
}
// WindowIcon
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) {
if (cmSystemTools::FileExists(option)) {
- InstallerWindowIcon = option;
+ this->InstallerWindowIcon = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option);
}
}
// Logo
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_LOGO")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) {
if (cmSystemTools::FileExists(option)) {
- Logo = option;
+ this->Logo = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option);
}
}
// Watermark
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_WATERMARK")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) {
if (cmSystemTools::FileExists(option)) {
- Watermark = option;
+ this->Watermark = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option);
}
}
// Banner
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_BANNER")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) {
if (cmSystemTools::FileExists(option)) {
- Banner = option;
+ this->Banner = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option);
}
}
// Background
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) {
if (cmSystemTools::FileExists(option)) {
- Background = option;
+ this->Background = option;
} else {
- printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option);
+ this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option);
}
}
// WizardStyle
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) {
- if (WizardStyle.compare("Modern") == 0 &&
- WizardStyle.compare("Aero") == 0 && WizardStyle.compare("Mac") == 0 &&
- WizardStyle.compare("Classic") == 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING,
- "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) {
+ // Setting the user value in any case
+ this->WizardStyle = option;
+ // Check known values
+ if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" &&
+ this->WizardStyle != "Mac" && this->WizardStyle != "Classic") {
+ cmCPackIFWLogger(
+ WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
<< option << "\". Expected values are: Modern, Aero, Mac, Classic."
<< std::endl);
}
-
- WizardStyle = option;
}
// WizardDefaultWidth
if (const char* option =
- GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) {
- WizardDefaultWidth = option;
+ this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) {
+ this->WizardDefaultWidth = option;
}
// WizardDefaultHeight
if (const char* option =
- GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) {
- WizardDefaultHeight = option;
+ this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) {
+ this->WizardDefaultHeight = option;
}
// TitleColor
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) {
- TitleColor = option;
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) {
+ this->TitleColor = option;
}
// Start menu
if (const char* optIFW_START_MENU_DIR =
this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) {
- StartMenuDir = optIFW_START_MENU_DIR;
+ this->StartMenuDir = optIFW_START_MENU_DIR;
} else {
- StartMenuDir = Name;
+ this->StartMenuDir = Name;
}
// Default target directory for installation
if (const char* optIFW_TARGET_DIRECTORY =
- GetOption("CPACK_IFW_TARGET_DIRECTORY")) {
- TargetDir = optIFW_TARGET_DIRECTORY;
+ this->GetOption("CPACK_IFW_TARGET_DIRECTORY")) {
+ this->TargetDir = optIFW_TARGET_DIRECTORY;
} else if (const char* optPACKAGE_INSTALL_DIRECTORY =
- GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
- TargetDir = "@ApplicationsDir@/";
- TargetDir += optPACKAGE_INSTALL_DIRECTORY;
+ this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
+ this->TargetDir = "@ApplicationsDir@/";
+ this->TargetDir += optPACKAGE_INSTALL_DIRECTORY;
} else {
- TargetDir = "@RootDir@/usr/local";
+ this->TargetDir = "@RootDir@/usr/local";
}
// Default target directory for installation with administrator rights
- if (const char* option = GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) {
- AdminTargetDir = option;
+ if (const char* option =
+ this->GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) {
+ this->AdminTargetDir = option;
}
// Maintenance tool
if (const char* optIFW_MAINTENANCE_TOOL =
this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) {
- MaintenanceToolName = optIFW_MAINTENANCE_TOOL;
+ this->MaintenanceToolName = optIFW_MAINTENANCE_TOOL;
}
// Maintenance tool ini file
if (const char* optIFW_MAINTENANCE_TOOL_INI =
this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE")) {
- MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI;
+ this->MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI;
}
// Allow non-ASCII characters
if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) {
- if (IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) {
- AllowNonAsciiCharacters = "true";
+ if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) {
+ this->AllowNonAsciiCharacters = "true";
} else {
- AllowNonAsciiCharacters = "false";
+ this->AllowNonAsciiCharacters = "false";
}
}
// Space in path
if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
- if (IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
- AllowSpaceInPath = "true";
+ if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) {
+ this->AllowSpaceInPath = "true";
} else {
- AllowSpaceInPath = "false";
+ this->AllowSpaceInPath = "false";
}
}
// Control script
if (const char* optIFW_CONTROL_SCRIPT =
this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) {
- ControlScript = optIFW_CONTROL_SCRIPT;
+ this->ControlScript = optIFW_CONTROL_SCRIPT;
}
// Resources
if (const char* optIFW_PACKAGE_RESOURCES =
this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
- Resources.clear();
- cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES, Resources);
+ this->Resources.clear();
+ cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES,
+ this->Resources);
}
}
@@ -280,19 +241,20 @@ public:
: installer(i)
, file(false)
{
- path = i->Directory + "/resources";
+ this->path = i->Directory + "/resources";
}
bool ParseResource(size_t r)
{
- hasFiles = false;
- hasErrors = false;
+ this->hasFiles = false;
+ this->hasErrors = false;
- basePath = cmSystemTools::GetFilenamePath(installer->Resources[r].data());
+ this->basePath =
+ cmSystemTools::GetFilenamePath(this->installer->Resources[r]);
- ParseFile(installer->Resources[r].data());
+ this->ParseFile(this->installer->Resources[r].data());
- return hasFiles && !hasErrors;
+ return this->hasFiles && !this->hasErrors;
}
cmCPackIFWInstaller* installer;
@@ -302,22 +264,22 @@ public:
protected:
void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE
{
- file = name == "file";
+ this->file = name == "file";
if (file) {
- hasFiles = true;
+ this->hasFiles = true;
}
}
void CharacterDataHandler(const char* data, int length) CM_OVERRIDE
{
- if (file) {
+ if (this->file) {
std::string content(data, data + length);
content = cmSystemTools::TrimWhitespace(content);
- std::string source = basePath + "/" + content;
- std::string destination = path + "/" + content;
+ std::string source = this->basePath + "/" + content;
+ std::string destination = this->path + "/" + content;
if (!cmSystemTools::CopyFileIfDifferent(source.data(),
destination.data())) {
- hasErrors = true;
+ this->hasErrors = true;
}
}
}
@@ -328,12 +290,12 @@ protected:
void cmCPackIFWInstaller::GenerateInstallerFile()
{
// Lazy directory initialization
- if (Directory.empty() && Generator) {
- Directory = Generator->toplevel;
+ if (this->Directory.empty() && this->Generator) {
+ this->Directory = this->Generator->toplevel;
}
// Output stream
- cmGeneratedFileStream fout((Directory + "/config/config.xml").data());
+ cmGeneratedFileStream fout((this->Directory + "/config/config.xml").data());
cmXMLWriter xout(fout);
xout.StartDocument();
@@ -342,166 +304,165 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.StartElement("Installer");
- xout.Element("Name", Name);
- xout.Element("Version", Version);
- xout.Element("Title", Title);
+ xout.Element("Name", this->Name);
+ xout.Element("Version", this->Version);
+ xout.Element("Title", this->Title);
- if (!Publisher.empty()) {
- xout.Element("Publisher", Publisher);
+ if (!this->Publisher.empty()) {
+ xout.Element("Publisher", this->Publisher);
}
- if (!ProductUrl.empty()) {
- xout.Element("ProductUrl", ProductUrl);
+ if (!this->ProductUrl.empty()) {
+ xout.Element("ProductUrl", this->ProductUrl);
}
// ApplicationIcon
- if (!InstallerApplicationIcon.empty()) {
+ if (!this->InstallerApplicationIcon.empty()) {
std::string name =
- cmSystemTools::GetFilenameName(InstallerApplicationIcon);
- std::string path = Directory + "/config/" + name;
+ cmSystemTools::GetFilenameName(this->InstallerApplicationIcon);
+ std::string path = this->Directory + "/config/" + name;
name = cmSystemTools::GetFilenameWithoutExtension(name);
- cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon.data(),
- path.data());
+ cmsys::SystemTools::CopyFileIfDifferent(this->InstallerApplicationIcon,
+ path);
xout.Element("InstallerApplicationIcon", name);
}
// WindowIcon
- if (!InstallerWindowIcon.empty()) {
- std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon.data(),
- path.data());
+ if (!this->InstallerWindowIcon.empty()) {
+ std::string name =
+ cmSystemTools::GetFilenameName(this->InstallerWindowIcon);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->InstallerWindowIcon, path);
xout.Element("InstallerWindowIcon", name);
}
// Logo
- if (!Logo.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Logo);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data());
+ if (!this->Logo.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Logo);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Logo, path);
xout.Element("Logo", name);
}
// Banner
- if (!Banner.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Banner);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Banner.data(), path.data());
+ if (!this->Banner.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Banner);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Banner, path);
xout.Element("Banner", name);
}
// Watermark
- if (!Watermark.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Watermark);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Watermark.data(), path.data());
+ if (!this->Watermark.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Watermark);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Watermark, path);
xout.Element("Watermark", name);
}
// Background
- if (!Background.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Background);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Background.data(), path.data());
+ if (!this->Background.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Background);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Background, path);
xout.Element("Background", name);
}
// WizardStyle
- if (!WizardStyle.empty()) {
- xout.Element("WizardStyle", WizardStyle);
+ if (!this->WizardStyle.empty()) {
+ xout.Element("WizardStyle", this->WizardStyle);
}
// WizardDefaultWidth
- if (!WizardDefaultWidth.empty()) {
- xout.Element("WizardDefaultWidth", WizardDefaultWidth);
+ if (!this->WizardDefaultWidth.empty()) {
+ xout.Element("WizardDefaultWidth", this->WizardDefaultWidth);
}
// WizardDefaultHeight
- if (!WizardDefaultHeight.empty()) {
- xout.Element("WizardDefaultHeight", WizardDefaultHeight);
+ if (!this->WizardDefaultHeight.empty()) {
+ xout.Element("WizardDefaultHeight", this->WizardDefaultHeight);
}
// TitleColor
- if (!TitleColor.empty()) {
- xout.Element("TitleColor", TitleColor);
+ if (!this->TitleColor.empty()) {
+ xout.Element("TitleColor", this->TitleColor);
}
// Start menu
- if (!IsVersionLess("2.0")) {
- xout.Element("StartMenuDir", StartMenuDir);
+ if (!this->IsVersionLess("2.0")) {
+ xout.Element("StartMenuDir", this->StartMenuDir);
}
// Target dir
- if (!TargetDir.empty()) {
- xout.Element("TargetDir", TargetDir);
+ if (!this->TargetDir.empty()) {
+ xout.Element("TargetDir", this->TargetDir);
}
// Admin target dir
- if (!AdminTargetDir.empty()) {
- xout.Element("AdminTargetDir", AdminTargetDir);
+ if (!this->AdminTargetDir.empty()) {
+ xout.Element("AdminTargetDir", this->AdminTargetDir);
}
// Remote repositories
- if (!RemoteRepositories.empty()) {
+ if (!this->RemoteRepositories.empty()) {
xout.StartElement("RemoteRepositories");
- for (RepositoriesVector::iterator rit = RemoteRepositories.begin();
- rit != RemoteRepositories.end(); ++rit) {
+ for (RepositoriesVector::iterator rit = this->RemoteRepositories.begin();
+ rit != this->RemoteRepositories.end(); ++rit) {
(*rit)->WriteRepositoryConfig(xout);
}
xout.EndElement();
}
// Maintenance tool
- if (!IsVersionLess("2.0") && !MaintenanceToolName.empty()) {
- xout.Element("MaintenanceToolName", MaintenanceToolName);
+ if (!this->IsVersionLess("2.0") && !this->MaintenanceToolName.empty()) {
+ xout.Element("MaintenanceToolName", this->MaintenanceToolName);
}
// Maintenance tool ini file
- if (!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty()) {
- xout.Element("MaintenanceToolIniFile", MaintenanceToolIniFile);
+ if (!this->IsVersionLess("2.0") && !this->MaintenanceToolIniFile.empty()) {
+ xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile);
}
// Different allows
- if (IsVersionLess("2.0")) {
+ if (this->IsVersionLess("2.0")) {
// CPack IFW default policy
xout.Comment("CPack IFW default policy for QtIFW less 2.0");
xout.Element("AllowNonAsciiCharacters", "true");
xout.Element("AllowSpaceInPath", "true");
} else {
- if (!AllowNonAsciiCharacters.empty()) {
- xout.Element("AllowNonAsciiCharacters", AllowNonAsciiCharacters);
+ if (!this->AllowNonAsciiCharacters.empty()) {
+ xout.Element("AllowNonAsciiCharacters", this->AllowNonAsciiCharacters);
}
- if (!AllowSpaceInPath.empty()) {
- xout.Element("AllowSpaceInPath", AllowSpaceInPath);
+ if (!this->AllowSpaceInPath.empty()) {
+ xout.Element("AllowSpaceInPath", this->AllowSpaceInPath);
}
}
// Control script (copy to config dir)
- if (!IsVersionLess("2.0") && !ControlScript.empty()) {
- std::string name = cmSystemTools::GetFilenameName(ControlScript);
- std::string path = Directory + "/config/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data());
+ if (!this->IsVersionLess("2.0") && !this->ControlScript.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->ControlScript);
+ std::string path = this->Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->ControlScript, path);
xout.Element("ControlScript", name);
}
// Resources (copy to resources dir)
- if (!Resources.empty()) {
+ if (!this->Resources.empty()) {
std::vector<std::string> resources;
cmCPackIFWResourcesParser parser(this);
- for (size_t i = 0; i < Resources.size(); i++) {
+ for (size_t i = 0; i < this->Resources.size(); i++) {
if (parser.ParseResource(i)) {
- std::string name = cmSystemTools::GetFilenameName(Resources[i]);
- std::string path = Directory + "/resources/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Resources[i].data(),
- path.data());
+ std::string name = cmSystemTools::GetFilenameName(this->Resources[i]);
+ std::string path = this->Directory + "/resources/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path);
resources.push_back(name);
} else {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "Can't copy resources from \""
- << Resources[i] << "\". Resource will be skipped."
- << std::endl);
+ cmCPackIFWLogger(WARNING, "Can't copy resources from \""
+ << this->Resources[i]
+ << "\". Resource will be skipped." << std::endl);
}
}
- Resources = resources;
+ this->Resources = resources;
}
xout.EndElement();
@@ -510,13 +471,13 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
void cmCPackIFWInstaller::GeneratePackageFiles()
{
- if (Packages.empty() || Generator->IsOnePackage()) {
+ if (this->Packages.empty() || this->Generator->IsOnePackage()) {
// Generate default package
cmCPackIFWPackage package;
- package.Generator = Generator;
+ package.Generator = this->Generator;
package.Installer = this;
// Check package group
- if (const char* option = GetOption("CPACK_IFW_PACKAGE_GROUP")) {
+ if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) {
package.ConfigureFromGroup(option);
std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" +
cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION";
@@ -531,16 +492,9 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
}
// Generate packages meta information
- for (PackagesMap::iterator pit = Packages.begin(); pit != Packages.end();
- ++pit) {
+ for (PackagesMap::iterator pit = this->Packages.begin();
+ pit != this->Packages.end(); ++pit) {
cmCPackIFWPackage* package = pit->second;
package->GeneratePackageFile();
}
}
-
-void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index 4ec3e70..b635f42 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -3,21 +3,21 @@
#ifndef cmCPackIFWInstaller_h
#define cmCPackIFWInstaller_h
-#include <cmConfigure.h> // IWYU pragma: keep
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include "cmCPackIFWCommon.h"
#include <map>
#include <string>
#include <vector>
-class cmCPackIFWGenerator;
class cmCPackIFWPackage;
class cmCPackIFWRepository;
-class cmXMLWriter;
/** \class cmCPackIFWInstaller
* \brief A binary installer to be created CPack IFW generator
*/
-class cmCPackIFWInstaller
+class cmCPackIFWInstaller : public cmCPackIFWCommon
{
public:
// Types
@@ -111,28 +111,17 @@ public:
public:
// Internal implementation
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
void ConfigureFromOptions();
void GenerateInstallerFile();
void GeneratePackageFiles();
- cmCPackIFWGenerator* Generator;
PackagesMap Packages;
RepositoriesVector RemoteRepositories;
std::string Directory;
protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
-
-private:
void printSkippedOptionWarning(const std::string& optionName,
const std::string& optionValue);
};
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index e23b1b9..c5311c3 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -2,38 +2,24 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWPackage.h"
-#include "CPack/cmCPackComponentGroup.h"
-#include "CPack/cmCPackGenerator.h"
-#include "CPack/cmCPackLog.h"
+#include "cmCPackComponentGroup.h"
+#include "cmCPackIFWCommon.h"
#include "cmCPackIFWGenerator.h"
#include "cmCPackIFWInstaller.h"
+#include "cmCPackLog.h" // IWYU pragma: keep
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmTimestamp.h"
#include "cmXMLWriter.h"
-#include <cmConfigure.h>
#include <map>
#include <sstream>
#include <stddef.h>
-
-//----------------------------------------------------------------- Logger ---
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
+#include <utility>
//---------------------------------------------------------- CompareStruct ---
cmCPackIFWPackage::CompareStruct::CompareStruct()
- : Type(CompareNone)
+ : Type(cmCPackIFWPackage::CompareNone)
{
}
@@ -48,101 +34,66 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
// Search compare section
size_t pos = std::string::npos;
if ((pos = dependence.find("<=")) != std::string::npos) {
- Compare.Type = CompareLessOrEqual;
- Compare.Value = dependence.substr(pos + 2);
+ this->Compare.Type = cmCPackIFWPackage::CompareLessOrEqual;
+ this->Compare.Value = dependence.substr(pos + 2);
} else if ((pos = dependence.find(">=")) != std::string::npos) {
- Compare.Type = CompareGreaterOrEqual;
- Compare.Value = dependence.substr(pos + 2);
+ this->Compare.Type = cmCPackIFWPackage::CompareGreaterOrEqual;
+ this->Compare.Value = dependence.substr(pos + 2);
} else if ((pos = dependence.find('<')) != std::string::npos) {
- Compare.Type = CompareLess;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareLess;
+ this->Compare.Value = dependence.substr(pos + 1);
} else if ((pos = dependence.find('=')) != std::string::npos) {
- Compare.Type = CompareEqual;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareEqual;
+ this->Compare.Value = dependence.substr(pos + 1);
} else if ((pos = dependence.find('>')) != std::string::npos) {
- Compare.Type = CompareGreater;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareGreater;
+ this->Compare.Value = dependence.substr(pos + 1);
} else if ((pos = dependence.find('-')) != std::string::npos) {
- Compare.Type = CompareNone;
- Compare.Value = dependence.substr(pos + 1);
+ this->Compare.Type = cmCPackIFWPackage::CompareNone;
+ this->Compare.Value = dependence.substr(pos + 1);
}
size_t dashPos = dependence.find('-');
if (dashPos != std::string::npos) {
pos = dashPos;
}
- Name = pos == std::string::npos ? dependence : dependence.substr(0, pos);
+ this->Name =
+ pos == std::string::npos ? dependence : dependence.substr(0, pos);
}
std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
{
- if (Compare.Type == CompareNone) {
- return Name;
+ if (this->Compare.Type == cmCPackIFWPackage::CompareNone) {
+ return this->Name;
}
- std::string result = Name;
+ std::string result = this->Name;
- if (Compare.Type != CompareNone || !Compare.Value.empty()) {
+ if (this->Compare.Type != cmCPackIFWPackage::CompareNone ||
+ !this->Compare.Value.empty()) {
result += "-";
}
- if (Compare.Type == CompareLessOrEqual) {
+ if (this->Compare.Type == cmCPackIFWPackage::CompareLessOrEqual) {
result += "<=";
- } else if (Compare.Type == CompareGreaterOrEqual) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareGreaterOrEqual) {
result += ">=";
- } else if (Compare.Type == CompareLess) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareLess) {
result += "<";
- } else if (Compare.Type == CompareEqual) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareEqual) {
result += "=";
- } else if (Compare.Type == CompareGreater) {
+ } else if (this->Compare.Type == cmCPackIFWPackage::CompareGreater) {
result += ">";
}
- result += Compare.Value;
+ result += this->Compare.Value;
return result;
}
//------------------------------------------------------ cmCPackIFWPackage ---
cmCPackIFWPackage::cmCPackIFWPackage()
- : Generator(CM_NULLPTR)
- , Installer(CM_NULLPTR)
-{
-}
-
-const char* cmCPackIFWPackage::GetOption(const std::string& op) const
-{
- const char* option = Generator ? Generator->GetOption(op) : CM_NULLPTR;
- return option && *option ? option : CM_NULLPTR;
-}
-
-bool cmCPackIFWPackage::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWPackage::IsSetToOff(const std::string& op) const
-{
- return Generator ? Generator->IsSetToOff(op) : false;
-}
-
-bool cmCPackIFWPackage::IsSetToEmpty(const std::string& op) const
-{
- return Generator ? Generator->IsSetToEmpty(op) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWPackage::IsVersionEqual(const char* version)
+ : Installer(CM_NULLPTR)
{
- return Generator ? Generator->IsVersionEqual(version) : false;
}
std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
@@ -151,62 +102,62 @@ std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
return "";
}
const char* option =
- GetOption("CPACK_IFW_COMPONENT_" +
- cmsys::SystemTools::UpperCase(component->Name) + "_NAME");
+ this->GetOption("CPACK_IFW_COMPONENT_" +
+ cmsys::SystemTools::UpperCase(component->Name) + "_NAME");
return option ? option : component->Name;
}
void cmCPackIFWPackage::DefaultConfiguration()
{
- DisplayName = "";
- Description = "";
- Version = "";
- ReleaseDate = "";
- Script = "";
- Licenses.clear();
- UserInterfaces.clear();
- Translations.clear();
- SortingPriority = "";
- UpdateText = "";
- Default = "";
- Essential = "";
- Virtual = "";
- ForcedInstallation = "";
- RequiresAdminRights = "";
+ this->DisplayName.clear();
+ this->Description.clear();
+ this->Version = "";
+ this->ReleaseDate = "";
+ this->Script = "";
+ this->Licenses.clear();
+ this->UserInterfaces.clear();
+ this->Translations.clear();
+ this->SortingPriority = "";
+ this->UpdateText = "";
+ this->Default = "";
+ this->Essential = "";
+ this->Virtual = "";
+ this->ForcedInstallation = "";
+ this->RequiresAdminRights = "";
}
// Defaul configuration (all in one package)
int cmCPackIFWPackage::ConfigureFromOptions()
{
// Restore defaul configuration
- DefaultConfiguration();
+ this->DefaultConfiguration();
// Name
- Name = Generator->GetRootPackageName();
+ this->Name = this->Generator->GetRootPackageName();
// Display name
if (const char* option = this->GetOption("CPACK_PACKAGE_NAME")) {
- DisplayName = option;
+ this->DisplayName[""] = option;
} else {
- DisplayName = "Your package";
+ this->DisplayName[""] = "Your package";
}
// Description
if (const char* option =
this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) {
- Description = option;
+ this->Description[""] = option;
} else {
- Description = "Your package description";
+ this->Description[""] = "Your package description";
}
// Version
- if (const char* option = GetOption("CPACK_PACKAGE_VERSION")) {
- Version = option;
+ if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = option;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
- ForcedInstallation = "true";
+ this->ForcedInstallation = "true";
return 1;
}
@@ -218,36 +169,36 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
}
// Restore defaul configuration
- DefaultConfiguration();
+ this->DefaultConfiguration();
std::string prefix = "CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_";
// Display name
- DisplayName = component->DisplayName;
+ this->DisplayName[""] = component->DisplayName;
// Description
- Description = component->Description;
+ this->Description[""] = component->Description;
// Version
- if (const char* optVERSION = GetOption(prefix + "VERSION")) {
- Version = optVERSION;
+ if (const char* optVERSION = this->GetOption(prefix + "VERSION")) {
+ this->Version = optVERSION;
} else if (const char* optPACKAGE_VERSION =
- GetOption("CPACK_PACKAGE_VERSION")) {
- Version = optPACKAGE_VERSION;
+ this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = optPACKAGE_VERSION;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
// Script
- if (const char* option = GetOption(prefix + "SCRIPT")) {
- Script = option;
+ if (const char* option = this->GetOption(prefix + "SCRIPT")) {
+ this->Script = option;
}
// User interfaces
if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
- UserInterfaces.clear();
- cmSystemTools::ExpandListArgument(option, UserInterfaces);
+ this->UserInterfaces.clear();
+ cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
}
// CMake dependencies
@@ -255,49 +206,49 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
std::vector<cmCPackComponent*>::iterator dit;
for (dit = component->Dependencies.begin();
dit != component->Dependencies.end(); ++dit) {
- Dependencies.insert(Generator->ComponentPackages[*dit]);
+ this->Dependencies.insert(this->Generator->ComponentPackages[*dit]);
}
}
// Licenses
if (const char* option = this->GetOption(prefix + "LICENSES")) {
- Licenses.clear();
- cmSystemTools::ExpandListArgument(option, Licenses);
- if (Licenses.size() % 2 != 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, prefix
- << "LICENSES"
- << " should contain pairs of <display_name> and <file_path>."
- << std::endl);
- Licenses.clear();
+ this->Licenses.clear();
+ cmSystemTools::ExpandListArgument(option, this->Licenses);
+ if (this->Licenses.size() % 2 != 0) {
+ cmCPackIFWLogger(
+ WARNING,
+ prefix << "LICENSES"
+ << " should contain pairs of <display_name> and <file_path>."
+ << std::endl);
+ this->Licenses.clear();
}
}
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
- SortingPriority = option;
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ this->SortingPriority = option;
+ cmCPackIFWLogger(
+ WARNING, "The \"PRIORITY\" option is set "
<< "for component \"" << component->Name << "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
<< std::endl);
}
// Default
- Default = component->IsDisabledByDefault ? "false" : "true";
+ this->Default = component->IsDisabledByDefault ? "false" : "true";
// Essential
if (this->IsOn(prefix + "ESSENTIAL")) {
- Essential = "true";
+ this->Essential = "true";
}
// Virtual
- Virtual = component->IsHidden ? "true" : "";
+ this->Virtual = component->IsHidden ? "true" : "";
// ForcedInstallation
- ForcedInstallation = component->IsRequired ? "true" : "false";
+ this->ForcedInstallation = component->IsRequired ? "true" : "false";
- return ConfigureFromPrefix(prefix);
+ return this->ConfigureFromPrefix(prefix);
}
int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
@@ -307,61 +258,61 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
}
// Restore defaul configuration
- DefaultConfiguration();
+ this->DefaultConfiguration();
std::string prefix = "CPACK_IFW_COMPONENT_GROUP_" +
cmsys::SystemTools::UpperCase(group->Name) + "_";
- DisplayName = group->DisplayName;
- Description = group->Description;
+ this->DisplayName[""] = group->DisplayName;
+ this->Description[""] = group->Description;
// Version
- if (const char* optVERSION = GetOption(prefix + "VERSION")) {
- Version = optVERSION;
+ if (const char* optVERSION = this->GetOption(prefix + "VERSION")) {
+ this->Version = optVERSION;
} else if (const char* optPACKAGE_VERSION =
- GetOption("CPACK_PACKAGE_VERSION")) {
- Version = optPACKAGE_VERSION;
+ this->GetOption("CPACK_PACKAGE_VERSION")) {
+ this->Version = optPACKAGE_VERSION;
} else {
- Version = "1.0.0";
+ this->Version = "1.0.0";
}
// Script
- if (const char* option = GetOption(prefix + "SCRIPT")) {
- Script = option;
+ if (const char* option = this->GetOption(prefix + "SCRIPT")) {
+ this->Script = option;
}
// User interfaces
if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
- UserInterfaces.clear();
- cmSystemTools::ExpandListArgument(option, UserInterfaces);
+ this->UserInterfaces.clear();
+ cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
}
// Licenses
if (const char* option = this->GetOption(prefix + "LICENSES")) {
- Licenses.clear();
- cmSystemTools::ExpandListArgument(option, Licenses);
- if (Licenses.size() % 2 != 0) {
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, prefix
- << "LICENSES"
- << " should contain pairs of <display_name> and <file_path>."
- << std::endl);
- Licenses.clear();
+ this->Licenses.clear();
+ cmSystemTools::ExpandListArgument(option, this->Licenses);
+ if (this->Licenses.size() % 2 != 0) {
+ cmCPackIFWLogger(
+ WARNING,
+ prefix << "LICENSES"
+ << " should contain pairs of <display_name> and <file_path>."
+ << std::endl);
+ this->Licenses.clear();
}
}
// Priority
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
- SortingPriority = option;
- cmCPackLogger(
- cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set "
+ this->SortingPriority = option;
+ cmCPackIFWLogger(
+ WARNING, "The \"PRIORITY\" option is set "
<< "for component group \"" << group->Name
<< "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
<< std::endl);
}
- return ConfigureFromPrefix(prefix);
+ return this->ConfigureFromPrefix(prefix);
}
int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
@@ -372,29 +323,29 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
std::string prefix =
"CPACK_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(groupName) + "_";
- if (const char* option = GetOption(prefix + "DISPLAY_NAME")) {
+ if (const char* option = this->GetOption(prefix + "DISPLAY_NAME")) {
group.DisplayName = option;
} else {
group.DisplayName = group.Name;
}
- if (const char* option = GetOption(prefix + "DESCRIPTION")) {
+ if (const char* option = this->GetOption(prefix + "DESCRIPTION")) {
group.Description = option;
}
- group.IsBold = IsOn(prefix + "BOLD_TITLE");
- group.IsExpandedByDefault = IsOn(prefix + "EXPANDED");
+ group.IsBold = this->IsOn(prefix + "BOLD_TITLE");
+ group.IsExpandedByDefault = this->IsOn(prefix + "EXPANDED");
// Package configuration
group.Name = groupName;
if (Generator) {
- Name = Generator->GetGroupPackageName(&group);
+ this->Name = this->Generator->GetGroupPackageName(&group);
} else {
- Name = group.Name;
+ this->Name = group.Name;
}
- return ConfigureFromGroup(&group);
+ return this->ConfigureFromGroup(&group);
}
// Common options for components and groups
@@ -405,51 +356,51 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
// Display name
option = prefix + "DISPLAY_NAME";
- if (IsSetToEmpty(option)) {
- DisplayName.clear();
- } else if (const char* value = GetOption(option)) {
- DisplayName = value;
+ if (this->IsSetToEmpty(option)) {
+ this->DisplayName.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->ExpandListArgument(value, this->DisplayName);
}
// Description
option = prefix + "DESCRIPTION";
- if (IsSetToEmpty(option)) {
- Description.clear();
- } else if (const char* value = GetOption(option)) {
- Description = value;
+ if (this->IsSetToEmpty(option)) {
+ this->Description.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->ExpandListArgument(value, this->Description);
}
// Release date
option = prefix + "RELEASE_DATE";
- if (IsSetToEmpty(option)) {
- ReleaseDate.clear();
- } else if (const char* value = GetOption(option)) {
- ReleaseDate = value;
+ if (this->IsSetToEmpty(option)) {
+ this->ReleaseDate.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->ReleaseDate = value;
}
// Sorting priority
option = prefix + "SORTING_PRIORITY";
- if (IsSetToEmpty(option)) {
- SortingPriority.clear();
- } else if (const char* value = GetOption(option)) {
- SortingPriority = value;
+ if (this->IsSetToEmpty(option)) {
+ this->SortingPriority.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->SortingPriority = value;
}
// Update text
option = prefix + "UPDATE_TEXT";
- if (IsSetToEmpty(option)) {
- UpdateText.clear();
- } else if (const char* value = GetOption(option)) {
- UpdateText = value;
+ if (this->IsSetToEmpty(option)) {
+ this->UpdateText.clear();
+ } else if (const char* value = this->GetOption(option)) {
+ this->UpdateText = value;
}
// Translations
option = prefix + "TRANSLATIONS";
- if (IsSetToEmpty(option)) {
- Translations.clear();
+ if (this->IsSetToEmpty(option)) {
+ this->Translations.clear();
} else if (const char* value = this->GetOption(option)) {
- Translations.clear();
- cmSystemTools::ExpandListArgument(value, Translations);
+ this->Translations.clear();
+ cmSystemTools::ExpandListArgument(value, this->Translations);
}
// QtIFW dependencies
@@ -465,84 +416,84 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
for (std::vector<std::string>::iterator dit = deps.begin();
dit != deps.end(); ++dit) {
DependenceStruct dep(*dit);
- if (Generator->Packages.count(dep.Name)) {
- cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name];
+ if (this->Generator->Packages.count(dep.Name)) {
+ cmCPackIFWPackage& depPkg = this->Generator->Packages[dep.Name];
dep.Name = depPkg.Name;
}
- bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
- DependenceStruct& depRef = Generator->DependentPackages[dep.Name];
+ bool hasDep = this->Generator->DependentPackages.count(dep.Name) > 0;
+ DependenceStruct& depRef = this->Generator->DependentPackages[dep.Name];
if (!hasDep) {
depRef = dep;
}
- AlienDependencies.insert(&depRef);
+ this->AlienDependencies.insert(&depRef);
}
// Automatic dependency on
option = prefix + "AUTO_DEPEND_ON";
- if (IsSetToEmpty(option)) {
- AlienAutoDependOn.clear();
+ if (this->IsSetToEmpty(option)) {
+ this->AlienAutoDependOn.clear();
} else if (const char* value = this->GetOption(option)) {
std::vector<std::string> depsOn;
cmSystemTools::ExpandListArgument(value, depsOn);
for (std::vector<std::string>::iterator dit = depsOn.begin();
dit != depsOn.end(); ++dit) {
DependenceStruct dep(*dit);
- if (Generator->Packages.count(dep.Name)) {
- cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name];
+ if (this->Generator->Packages.count(dep.Name)) {
+ cmCPackIFWPackage& depPkg = this->Generator->Packages[dep.Name];
dep.Name = depPkg.Name;
}
- bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
- DependenceStruct& depRef = Generator->DependentPackages[dep.Name];
+ bool hasDep = this->Generator->DependentPackages.count(dep.Name) > 0;
+ DependenceStruct& depRef = this->Generator->DependentPackages[dep.Name];
if (!hasDep) {
depRef = dep;
}
- AlienAutoDependOn.insert(&depRef);
+ this->AlienAutoDependOn.insert(&depRef);
}
}
// Visibility
option = prefix + "VIRTUAL";
- if (IsSetToEmpty(option)) {
- Virtual.clear();
- } else if (IsOn(option)) {
- Virtual = "true";
+ if (this->IsSetToEmpty(option)) {
+ this->Virtual.clear();
+ } else if (this->IsOn(option)) {
+ this->Virtual = "true";
}
// Default selection
option = prefix + "DEFAULT";
- if (IsSetToEmpty(option)) {
- Default.clear();
- } else if (const char* value = GetOption(option)) {
+ if (this->IsSetToEmpty(option)) {
+ this->Default.clear();
+ } else if (const char* value = this->GetOption(option)) {
std::string lowerValue = cmsys::SystemTools::LowerCase(value);
- if (lowerValue.compare("true") == 0) {
- Default = "true";
- } else if (lowerValue.compare("false") == 0) {
- Default = "false";
- } else if (lowerValue.compare("script") == 0) {
- Default = "script";
+ if (lowerValue == "true") {
+ this->Default = "true";
+ } else if (lowerValue == "false") {
+ this->Default = "false";
+ } else if (lowerValue == "script") {
+ this->Default = "script";
} else {
- Default = value;
+ this->Default = value;
}
}
// Forsed installation
option = prefix + "FORCED_INSTALLATION";
- if (IsSetToEmpty(option)) {
- ForcedInstallation.clear();
- } else if (IsOn(option)) {
- ForcedInstallation = "true";
- } else if (IsSetToOff(option)) {
- ForcedInstallation = "false";
+ if (this->IsSetToEmpty(option)) {
+ this->ForcedInstallation.clear();
+ } else if (this->IsOn(option)) {
+ this->ForcedInstallation = "true";
+ } else if (this->IsSetToOff(option)) {
+ this->ForcedInstallation = "false";
}
// Requires admin rights
option = prefix + "REQUIRES_ADMIN_RIGHTS";
- if (IsSetToEmpty(option)) {
- RequiresAdminRights.clear();
- } else if (IsOn(option)) {
- RequiresAdminRights = "true";
- } else if (IsSetToOff(option)) {
- RequiresAdminRights = "false";
+ if (this->IsSetToEmpty(option)) {
+ this->RequiresAdminRights.clear();
+ } else if (this->IsOn(option)) {
+ this->RequiresAdminRights = "true";
+ } else if (this->IsSetToOff(option)) {
+ this->RequiresAdminRights = "false";
}
return 1;
@@ -551,16 +502,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
void cmCPackIFWPackage::GeneratePackageFile()
{
// Lazy directory initialization
- if (Directory.empty()) {
- if (Installer) {
- Directory = Installer->Directory + "/packages/" + Name;
- } else if (Generator) {
- Directory = Generator->toplevel + "/packages/" + Name;
+ if (this->Directory.empty()) {
+ if (this->Installer) {
+ this->Directory = this->Installer->Directory + "/packages/" + this->Name;
+ } else if (this->Generator) {
+ this->Directory = this->Generator->toplevel + "/packages/" + this->Name;
}
}
// Output stream
- cmGeneratedFileStream fout((Directory + "/meta/package.xml").data());
+ cmGeneratedFileStream fout((this->Directory + "/meta/package.xml").data());
cmXMLWriter xout(fout);
xout.StartDocument();
@@ -569,28 +520,49 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.StartElement("Package");
- xout.Element("DisplayName", DisplayName);
- xout.Element("Description", Description);
+ // DisplayName (with translations)
+ for (std::map<std::string, std::string>::iterator it =
+ this->DisplayName.begin();
+ it != this->DisplayName.end(); ++it) {
+ xout.StartElement("DisplayName");
+ if (!it->first.empty()) {
+ xout.Attribute("xml:lang", it->first);
+ }
+ xout.Content(it->second);
+ xout.EndElement();
+ }
+
+ // Description (with translations)
+ for (std::map<std::string, std::string>::iterator it =
+ this->Description.begin();
+ it != this->Description.end(); ++it) {
+ xout.StartElement("Description");
+ if (!it->first.empty()) {
+ xout.Attribute("xml:lang", it->first);
+ }
+ xout.Content(it->second);
+ xout.EndElement();
+ }
// Update text
- if (!UpdateText.empty()) {
- xout.Element("UpdateText", UpdateText);
+ if (!this->UpdateText.empty()) {
+ xout.Element("UpdateText", this->UpdateText);
}
- xout.Element("Name", Name);
- xout.Element("Version", Version);
+ xout.Element("Name", this->Name);
+ xout.Element("Version", this->Version);
- if (!ReleaseDate.empty()) {
- xout.Element("ReleaseDate", ReleaseDate);
+ if (!this->ReleaseDate.empty()) {
+ xout.Element("ReleaseDate", this->ReleaseDate);
} else {
xout.Element("ReleaseDate", cmTimestamp().CurrentTime("%Y-%m-%d", true));
}
// Script (copy to meta dir)
- if (!Script.empty()) {
- std::string name = cmSystemTools::GetFilenameName(Script);
- std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data());
+ if (!this->Script.empty()) {
+ std::string name = cmSystemTools::GetFilenameName(this->Script);
+ std::string path = this->Directory + "/meta/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(this->Script, path);
xout.Element("Script", name);
}
@@ -598,9 +570,8 @@ void cmCPackIFWPackage::GeneratePackageFile()
std::vector<std::string> userInterfaces = UserInterfaces;
for (size_t i = 0; i < userInterfaces.size(); i++) {
std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]);
- std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i].data(),
- path.data());
+ std::string path = this->Directory + "/meta/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i], path);
userInterfaces[i] = name;
}
if (!userInterfaces.empty()) {
@@ -615,9 +586,8 @@ void cmCPackIFWPackage::GeneratePackageFile()
std::vector<std::string> translations = Translations;
for (size_t i = 0; i < translations.size(); i++) {
std::string name = cmSystemTools::GetFilenameName(translations[i]);
- std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(),
- path.data());
+ std::string path = this->Directory + "/meta/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(translations[i], path);
translations[i] = name;
}
if (!translations.empty()) {
@@ -630,12 +600,13 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Dependencies
std::set<DependenceStruct> compDepSet;
- for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin();
- ait != AlienDependencies.end(); ++ait) {
+ for (std::set<DependenceStruct*>::iterator ait =
+ this->AlienDependencies.begin();
+ ait != this->AlienDependencies.end(); ++ait) {
compDepSet.insert(*(*ait));
}
- for (std::set<cmCPackIFWPackage*>::iterator it = Dependencies.begin();
- it != Dependencies.end(); ++it) {
+ for (std::set<cmCPackIFWPackage*>::iterator it = this->Dependencies.begin();
+ it != this->Dependencies.end(); ++it) {
compDepSet.insert(DependenceStruct((*it)->Name));
}
// Write dependencies
@@ -653,8 +624,9 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Automatic dependency on
std::set<DependenceStruct> compAutoDepSet;
- for (std::set<DependenceStruct*>::iterator ait = AlienAutoDependOn.begin();
- ait != AlienAutoDependOn.end(); ++ait) {
+ for (std::set<DependenceStruct*>::iterator ait =
+ this->AlienAutoDependOn.begin();
+ ait != this->AlienAutoDependOn.end(); ++ait) {
compAutoDepSet.insert(*(*ait));
}
// Write automatic dependency on
@@ -671,11 +643,11 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
// Licenses (copy to meta dir)
- std::vector<std::string> licenses = Licenses;
+ std::vector<std::string> licenses = this->Licenses;
for (size_t i = 1; i < licenses.size(); i += 2) {
std::string name = cmSystemTools::GetFilenameName(licenses[i]);
- std::string path = Directory + "/meta/" + name;
- cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data());
+ std::string path = this->Directory + "/meta/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(licenses[i], path);
licenses[i] = name;
}
if (!licenses.empty()) {
@@ -689,37 +661,30 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout.EndElement();
}
- if (!ForcedInstallation.empty()) {
- xout.Element("ForcedInstallation", ForcedInstallation);
+ if (!this->ForcedInstallation.empty()) {
+ xout.Element("ForcedInstallation", this->ForcedInstallation);
}
- if (!RequiresAdminRights.empty()) {
- xout.Element("RequiresAdminRights", RequiresAdminRights);
+ if (!this->RequiresAdminRights.empty()) {
+ xout.Element("RequiresAdminRights", this->RequiresAdminRights);
}
- if (!Virtual.empty()) {
- xout.Element("Virtual", Virtual);
- } else if (!Default.empty()) {
- xout.Element("Default", Default);
+ if (!this->Virtual.empty()) {
+ xout.Element("Virtual", this->Virtual);
+ } else if (!this->Default.empty()) {
+ xout.Element("Default", this->Default);
}
// Essential
- if (!Essential.empty()) {
- xout.Element("Essential", Essential);
+ if (!this->Essential.empty()) {
+ xout.Element("Essential", this->Essential);
}
// Priority
- if (!SortingPriority.empty()) {
- xout.Element("SortingPriority", SortingPriority);
+ if (!this->SortingPriority.empty()) {
+ xout.Element("SortingPriority", this->SortingPriority);
}
xout.EndElement();
xout.EndDocument();
}
-
-void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index bd1d6c5..cec59b0 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -3,22 +3,23 @@
#ifndef cmCPackIFWPackage_h
#define cmCPackIFWPackage_h
-#include <cmConfigure.h> // IWYU pragma: keep
+#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmCPackIFWCommon.h"
+
+#include <map>
#include <set>
#include <string>
#include <vector>
class cmCPackComponent;
class cmCPackComponentGroup;
-class cmCPackIFWGenerator;
class cmCPackIFWInstaller;
-class cmXMLWriter;
/** \class cmCPackIFWPackage
* \brief A single component to be installed by CPack IFW generator
*/
-class cmCPackIFWPackage
+class cmCPackIFWPackage : public cmCPackIFWCommon
{
public:
// Types
@@ -69,10 +70,10 @@ public:
// Configuration
/// Human-readable name of the component
- std::string DisplayName;
+ std::map<std::string, std::string> DisplayName;
/// Human-readable description of the component
- std::string Description;
+ std::map<std::string, std::string> Description;
/// Version number of the component
std::string Version;
@@ -119,15 +120,6 @@ public:
public:
// Internal implementation
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
- bool IsSetToOff(const std::string& op) const;
- bool IsSetToEmpty(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
std::string GetComponentName(cmCPackComponent* component);
void DefaultConfiguration();
@@ -140,8 +132,6 @@ public:
void GeneratePackageFile();
- // Pointer to generator
- cmCPackIFWGenerator* Generator;
// Pointer to installer
cmCPackIFWInstaller* Installer;
// Collection of dependencies
@@ -152,9 +142,6 @@ public:
std::set<DependenceStruct*> AlienAutoDependOn;
// Patch to package directory
std::string Directory;
-
-protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
};
#endif // cmCPackIFWPackage_h
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index cc204e8..b115db0 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -2,32 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWRepository.h"
-#include "CPack/cmCPackGenerator.h"
#include "cmCPackIFWGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#include <cmConfigure.h>
#include <stddef.h>
-#ifdef cmCPackLogger
-#undef cmCPackLogger
-#endif
-#define cmCPackLogger(logType, msg) \
- do { \
- std::ostringstream cmCPackLog_msg; \
- cmCPackLog_msg << msg; \
- if (Generator) { \
- Generator->Logger->Log(logType, __FILE__, __LINE__, \
- cmCPackLog_msg.str().c_str()); \
- } \
- } while (false)
-
cmCPackIFWRepository::cmCPackIFWRepository()
- : Update(None)
- , Generator(CM_NULLPTR)
+ : Update(cmCPackIFWRepository::None)
{
}
@@ -35,120 +19,95 @@ bool cmCPackIFWRepository::IsValid() const
{
bool valid = true;
- switch (Update) {
- case None:
- valid = !Url.empty();
+ switch (this->Update) {
+ case cmCPackIFWRepository::None:
+ valid = !this->Url.empty();
break;
- case Add:
- valid = !Url.empty();
+ case cmCPackIFWRepository::Add:
+ valid = !this->Url.empty();
break;
- case Remove:
- valid = !Url.empty();
+ case cmCPackIFWRepository::Remove:
+ valid = !this->Url.empty();
break;
- case Replace:
- valid = !OldUrl.empty() && !NewUrl.empty();
+ case cmCPackIFWRepository::Replace:
+ valid = !this->OldUrl.empty() && !this->NewUrl.empty();
break;
}
return valid;
}
-const char* cmCPackIFWRepository::GetOption(const std::string& op) const
-{
- return Generator ? Generator->GetOption(op) : CM_NULLPTR;
-}
-
-bool cmCPackIFWRepository::IsOn(const std::string& op) const
-{
- return Generator ? Generator->IsOn(op) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionLess(const char* version)
-{
- return Generator ? Generator->IsVersionLess(version) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionGreater(const char* version)
-{
- return Generator ? Generator->IsVersionGreater(version) : false;
-}
-
-bool cmCPackIFWRepository::IsVersionEqual(const char* version)
-{
- return Generator ? Generator->IsVersionEqual(version) : false;
-}
-
bool cmCPackIFWRepository::ConfigureFromOptions()
{
// Name;
- if (Name.empty()) {
+ if (this->Name.empty()) {
return false;
}
std::string prefix =
- "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_";
+ "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(this->Name) + "_";
// Update
- if (IsOn(prefix + "ADD")) {
- Update = Add;
+ if (this->IsOn(prefix + "ADD")) {
+ this->Update = cmCPackIFWRepository::Add;
} else if (IsOn(prefix + "REMOVE")) {
- Update = Remove;
+ this->Update = cmCPackIFWRepository::Remove;
} else if (IsOn(prefix + "REPLACE")) {
- Update = Replace;
+ this->Update = cmCPackIFWRepository::Replace;
} else {
- Update = None;
+ this->Update = cmCPackIFWRepository::None;
}
// Url
- if (const char* url = GetOption(prefix + "URL")) {
- Url = url;
+ if (const char* url = this->GetOption(prefix + "URL")) {
+ this->Url = url;
} else {
- Url = "";
+ this->Url = "";
}
// Old url
- if (const char* oldUrl = GetOption(prefix + "OLD_URL")) {
- OldUrl = oldUrl;
+ if (const char* oldUrl = this->GetOption(prefix + "OLD_URL")) {
+ this->OldUrl = oldUrl;
} else {
- OldUrl = "";
+ this->OldUrl = "";
}
// New url
- if (const char* newUrl = GetOption(prefix + "NEW_URL")) {
- NewUrl = newUrl;
+ if (const char* newUrl = this->GetOption(prefix + "NEW_URL")) {
+ this->NewUrl = newUrl;
} else {
- NewUrl = "";
+ this->NewUrl = "";
}
// Enabled
- if (IsOn(prefix + "DISABLED")) {
- Enabled = "0";
+ if (this->IsOn(prefix + "DISABLED")) {
+ this->Enabled = "0";
} else {
- Enabled = "";
+ this->Enabled = "";
}
// Username
- if (const char* username = GetOption(prefix + "USERNAME")) {
- Username = username;
+ if (const char* username = this->GetOption(prefix + "USERNAME")) {
+ this->Username = username;
} else {
- Username = "";
+ this->Username = "";
}
// Password
- if (const char* password = GetOption(prefix + "PASSWORD")) {
- Password = password;
+ if (const char* password = this->GetOption(prefix + "PASSWORD")) {
+ this->Password = password;
} else {
- Password = "";
+ this->Password = "";
}
// DisplayName
- if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) {
- DisplayName = displayName;
+ if (const char* displayName = this->GetOption(prefix + "DISPLAY_NAME")) {
+ this->DisplayName = displayName;
} else {
- DisplayName = "";
+ this->DisplayName = "";
}
- return IsValid();
+ return this->IsValid();
}
/** \class cmCPackeIFWUpdatesPatcher
@@ -171,8 +130,8 @@ public:
protected:
void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
{
- xout.StartElement(name);
- StartFragment(atts);
+ this->xout.StartElement(name);
+ this->StartFragment(atts);
}
void StartFragment(const char** atts)
@@ -180,23 +139,23 @@ protected:
for (size_t i = 0; atts[i]; i += 2) {
const char* key = atts[i];
const char* value = atts[i + 1];
- xout.Attribute(key, value);
+ this->xout.Attribute(key, value);
}
}
void EndElement(const std::string& name) CM_OVERRIDE
{
- if (name == "Updates" && !patched) {
- repository->WriteRepositoryUpdates(xout);
- patched = true;
+ if (name == "Updates" && !this->patched) {
+ this->repository->WriteRepositoryUpdates(this->xout);
+ this->patched = true;
}
- xout.EndElement();
- if (patched) {
+ this->xout.EndElement();
+ if (this->patched) {
return;
}
if (name == "Checksum") {
- repository->WriteRepositoryUpdates(xout);
- patched = true;
+ this->repository->WriteRepositoryUpdates(this->xout);
+ this->patched = true;
}
}
@@ -207,20 +166,21 @@ protected:
content == "\n") {
return;
}
- xout.Content(content);
+ this->xout.Content(content);
}
};
bool cmCPackIFWRepository::PatchUpdatesXml()
{
// Lazy directory initialization
- if (Directory.empty() && Generator) {
- Directory = Generator->toplevel;
+ if (this->Directory.empty() && this->Generator) {
+ this->Directory = this->Generator->toplevel;
}
// Filenames
- std::string updatesXml = Directory + "/repository/Updates.xml";
- std::string updatesPatchXml = Directory + "/repository/UpdatesPatch.xml";
+ std::string updatesXml = this->Directory + "/repository/Updates.xml";
+ std::string updatesPatchXml =
+ this->Directory + "/repository/UpdatesPatch.xml";
// Output stream
cmGeneratedFileStream fout(updatesPatchXml.data());
@@ -228,7 +188,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
xout.StartDocument();
- WriteGeneratedByToStrim(xout);
+ this->WriteGeneratedByToStrim(xout);
// Patch
{
@@ -248,22 +208,22 @@ void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
xout.StartElement("Repository");
// Url
- xout.Element("Url", Url);
+ xout.Element("Url", this->Url);
// Enabled
- if (!Enabled.empty()) {
- xout.Element("Enabled", Enabled);
+ if (!this->Enabled.empty()) {
+ xout.Element("Enabled", this->Enabled);
}
// Username
- if (!Username.empty()) {
- xout.Element("Username", Username);
+ if (!this->Username.empty()) {
+ xout.Element("Username", this->Username);
}
// Password
- if (!Password.empty()) {
- xout.Element("Password", Password);
+ if (!this->Password.empty()) {
+ xout.Element("Password", this->Password);
}
// DisplayName
- if (!DisplayName.empty()) {
- xout.Element("DisplayName", DisplayName);
+ if (!this->DisplayName.empty()) {
+ xout.Element("DisplayName", this->DisplayName);
}
xout.EndElement();
@@ -273,42 +233,43 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
{
xout.StartElement("Repository");
- switch (Update) {
- case None:
+ switch (this->Update) {
+ case cmCPackIFWRepository::None:
break;
- case Add:
+ case cmCPackIFWRepository::Add:
xout.Attribute("action", "add");
break;
- case Remove:
+ case cmCPackIFWRepository::Remove:
xout.Attribute("action", "remove");
break;
- case Replace:
+ case cmCPackIFWRepository::Replace:
xout.Attribute("action", "replace");
break;
}
// Url
- if (Update == Add || Update == Remove) {
- xout.Attribute("url", Url);
- } else if (Update == Replace) {
- xout.Attribute("oldUrl", OldUrl);
- xout.Attribute("newUrl", NewUrl);
+ if (this->Update == cmCPackIFWRepository::Add ||
+ this->Update == cmCPackIFWRepository::Remove) {
+ xout.Attribute("url", this->Url);
+ } else if (Update == cmCPackIFWRepository::Replace) {
+ xout.Attribute("oldUrl", this->OldUrl);
+ xout.Attribute("newUrl", this->NewUrl);
}
// Enabled
- if (!Enabled.empty()) {
- xout.Attribute("enabled", Enabled);
+ if (!this->Enabled.empty()) {
+ xout.Attribute("enabled", this->Enabled);
}
// Username
- if (!Username.empty()) {
- xout.Attribute("username", Username);
+ if (!this->Username.empty()) {
+ xout.Attribute("username", this->Username);
}
// Password
- if (!Password.empty()) {
- xout.Attribute("password", Password);
+ if (!this->Password.empty()) {
+ xout.Attribute("password", this->Password);
}
// DisplayName
- if (!DisplayName.empty()) {
- xout.Attribute("displayname", DisplayName);
+ if (!this->DisplayName.empty()) {
+ xout.Attribute("displayname", this->DisplayName);
}
xout.EndElement();
@@ -316,19 +277,12 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
{
- if (!RepositoryUpdate.empty()) {
+ if (!this->RepositoryUpdate.empty()) {
xout.StartElement("RepositoryUpdate");
- for (RepositoriesVector::iterator rit = RepositoryUpdate.begin();
- rit != RepositoryUpdate.end(); ++rit) {
+ for (RepositoriesVector::iterator rit = this->RepositoryUpdate.begin();
+ rit != this->RepositoryUpdate.end(); ++rit) {
(*rit)->WriteRepositoryUpdate(xout);
}
xout.EndElement();
}
}
-
-void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
-{
- if (Generator) {
- Generator->WriteGeneratedByToStrim(xout);
- }
-}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h
index 36f46da..227cfae 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.h
+++ b/Source/CPack/IFW/cmCPackIFWRepository.h
@@ -3,18 +3,19 @@
#ifndef cmCPackIFWRepository_h
#define cmCPackIFWRepository_h
-#include <cmConfigure.h> // IWYU pragma: keep
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include "cmCPackIFWCommon.h"
#include <string>
#include <vector>
-class cmCPackIFWGenerator;
class cmXMLWriter;
/** \class cmCPackIFWRepository
* \brief A remote repository to be created CPack IFW generator
*/
-class cmCPackIFWRepository
+class cmCPackIFWRepository : public cmCPackIFWCommon
{
public:
// Types
@@ -72,13 +73,6 @@ public:
bool IsValid() const;
- const char* GetOption(const std::string& op) const;
- bool IsOn(const std::string& op) const;
-
- bool IsVersionLess(const char* version);
- bool IsVersionGreater(const char* version);
- bool IsVersionEqual(const char* version);
-
bool ConfigureFromOptions();
bool PatchUpdatesXml();
@@ -87,12 +81,8 @@ public:
void WriteRepositoryUpdate(cmXMLWriter& xout);
void WriteRepositoryUpdates(cmXMLWriter& xout);
- cmCPackIFWGenerator* Generator;
RepositoriesVector RepositoryUpdate;
std::string Directory;
-
-protected:
- void WriteGeneratedByToStrim(cmXMLWriter& xout);
};
#endif // cmCPackIFWRepository_h
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index b159e64..b48bf12 100644
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ b/Source/CPack/OSXScriptLauncher.cxx
@@ -1,8 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include <cmsys/FStream.hxx>
-#include <cmsys/Process.h>
-#include <cmsys/SystemTools.hxx>
+#include "cmsys/FStream.hxx"
+#include "cmsys/Process.h"
+#include "cmsys/SystemTools.hxx"
#include <iostream>
#include <stddef.h>
#include <string>
@@ -20,7 +20,6 @@
int main(int argc, char* argv[])
{
// if ( cmsys::SystemTools::FileExists(
- std::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
cmsys::ofstream ofs("/tmp/output.txt");
CFStringRef fileName;
@@ -86,8 +85,6 @@ int main(int argc, char* argv[])
int length;
while (cmsysProcess_WaitForData(cp, &data, &length, 0)) {
// Translate NULL characters in the output into valid text.
- // Visual Studio 7 puts these characters in the output of its
- // build process.
for (int i = 0; i < length; ++i) {
if (data[i] == '\0') {
data[i] = ' ';
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 2bccf2e..274dfd0 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -2,14 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackWIXGenerator.h"
-#include <CPack/cmCPackComponentGroup.h>
-#include <CPack/cmCPackLog.h>
+#include "cmCPackComponentGroup.h"
+#include "cmCPackLog.h"
+#include "cmCryptoHash.h"
+#include "cmGeneratedFileStream.h"
+#include "cmInstalledFile.h"
+#include "cmSystemTools.h"
+#include "cmUuid.h"
#include <algorithm>
-#include <cmCryptoHash.h>
-#include <cmGeneratedFileStream.h>
-#include <cmInstalledFile.h>
-#include <cmSystemTools.h>
-#include <cmUuid.h>
#include "cmWIXDirectoriesSourceWriter.h"
#include "cmWIXFeaturesSourceWriter.h"
@@ -17,10 +17,10 @@
#include "cmWIXRichTextFormatWriter.h"
#include "cmWIXSourceWriter.h"
-#include <cmsys/Directory.hxx>
-#include <cmsys/Encoding.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/SystemTools.hxx>
+#include "cmsys/Directory.hxx"
+#include "cmsys/Encoding.hxx"
+#include "cmsys/FStream.hxx"
+#include "cmsys/SystemTools.hxx"
#include <rpc.h> // for GUID generation
@@ -437,8 +437,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
directoryDefinitions.AddAttribute("Name", "SourceDir");
size_t installRootSize =
- directoryDefinitions.BeginInstallationPrefixDirectory(
- GetProgramFilesFolderId(), installRoot);
+ directoryDefinitions.BeginInstallationPrefixDirectory(GetRootFolderId(),
+ installRoot);
std::string fileDefinitionsFilename = this->CPackTopLevel + "/files.wxs";
@@ -570,16 +570,26 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return this->Patch->CheckForUnappliedFragments();
}
-std::string cmCPackWIXGenerator::GetProgramFilesFolderId() const
+std::string cmCPackWIXGenerator::GetRootFolderId() const
{
if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
return "";
}
+
+ std::string result = "ProgramFiles<64>Folder";
+
+ const char* rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID");
+ if (rootFolderId) {
+ result = rootFolderId;
+ }
+
if (GetArchitecture() == "x86") {
- return "ProgramFilesFolder";
+ cmSystemTools::ReplaceString(result, "<64>", "");
} else {
- return "ProgramFiles64Folder";
+ cmSystemTools::ReplaceString(result, "<64>", "64");
}
+
+ return result;
}
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
@@ -667,10 +677,10 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
cpackPackageDesktopLinksList);
}
- AddDirectoryAndFileDefinitons(rootPath, "INSTALL_ROOT", directoryDefinitions,
- fileDefinitions, featureDefinitions,
- cpackPackageExecutablesList,
- cpackPackageDesktopLinksList, shortcuts);
+ AddDirectoryAndFileDefinitions(
+ rootPath, "INSTALL_ROOT", directoryDefinitions, fileDefinitions,
+ featureDefinitions, cpackPackageExecutablesList,
+ cpackPackageDesktopLinksList, shortcuts);
featureDefinitions.EndElement("FeatureRef");
@@ -831,7 +841,7 @@ bool cmCPackWIXGenerator::CreateLicenseFile()
return true;
}
-void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
+void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
@@ -896,12 +906,12 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", subDirectoryId);
directoryDefinitions.AddAttribute("Name", fileName);
+ this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
- AddDirectoryAndFileDefinitons(
+ AddDirectoryAndFileDefinitions(
fullPath, subDirectoryId, directoryDefinitions, fileDefinitions,
featureDefinitions, packageExecutables, desktopExecutables, shortcuts);
- this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions);
directoryDefinitions.EndElement("Directory");
} else {
cmInstalledFile const* installedFile = this->GetInstalledFile(
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index fc0994c..b2633a7 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackWIXGenerator_h
#define cmCPackWIXGenerator_h
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
#include "cmWIXPatch.h"
#include "cmWIXShortcut.h"
@@ -65,7 +65,7 @@ private:
bool CreateWiXSourceFiles();
- std::string GetProgramFilesFolderId() const;
+ std::string GetRootFolderId() const;
bool GenerateMainSourceFileFromTemplate();
@@ -104,7 +104,7 @@ private:
bool RunLightCommand(std::string const& objectFiles);
- void AddDirectoryAndFileDefinitons(
+ void AddDirectoryAndFileDefinitions(
std::string const& topdir, std::string const& directoryId,
cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXFilesSourceWriter& fileDefinitions,
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx
index 9f9b39c..744a932 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.cxx
+++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXAccessControlList.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
-#include <cmSystemTools.h>
+#include "cmSystemTools.h"
cmWIXAccessControlList::cmWIXAccessControlList(
cmCPackLog* logger, cmInstalledFile const& installedFile,
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.h b/Source/CPack/WiX/cmWIXAccessControlList.h
index 0a25ee5..2a23f2f 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.h
+++ b/Source/CPack/WiX/cmWIXAccessControlList.h
@@ -5,8 +5,8 @@
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackLog.h>
-#include <cmInstalledFile.h>
+#include "cmCPackLog.h"
+#include "cmInstalledFile.h"
class cmWIXAccessControlList
{
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
index 062efe3..8233331 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
@@ -5,7 +5,7 @@
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
#include <string>
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 79a9fdd..0be4377 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -44,6 +44,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
AddAttributeUnlessEmpty("Title", group.DisplayName);
AddAttributeUnlessEmpty("Description", group.Description);
+ patch.ApplyFragment("CM_G_" + group.Name, *this);
+
for (std::vector<cmCPackComponentGroup*>::const_iterator i =
group.Subgroups.begin();
i != group.Subgroups.end(); ++i) {
@@ -56,8 +58,6 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
EmitFeatureForComponent(**i, patch);
}
- patch.ApplyFragment("CM_G_" + group.Name, *this);
-
EndElement("Feature");
}
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
index 368b250..e751ca7 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
@@ -6,7 +6,7 @@
#include "cmWIXPatch.h"
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
/** \class cmWIXFeaturesSourceWriter
* \brief Helper class to generate features.wxs
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index a471d26..b4cd1a3 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -4,14 +4,12 @@
#include "cmWIXAccessControlList.h"
-#include <cmInstalledFile.h>
+#include "cmInstalledFile.h"
-#include <cmSystemTools.h>
-#include <cmUuid.h>
+#include "cmSystemTools.h"
+#include "cmUuid.h"
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
+#include "cm_sys_stat.h"
cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
std::string const& filename,
@@ -138,6 +136,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
}
}
+ patch.ApplyFragment(componentId, *this);
BeginElement("File");
AddAttribute("Id", fileId);
AddAttribute("Source", filePath);
@@ -149,16 +148,15 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
if (!(fileMode & S_IWRITE)) {
AddAttribute("ReadOnly", "yes");
}
+ patch.ApplyFragment(fileId, *this);
if (installedFile) {
cmWIXAccessControlList acl(Logger, *installedFile, *this);
acl.Apply();
}
- patch.ApplyFragment(fileId, *this);
EndElement("File");
- patch.ApplyFragment(componentId, *this);
EndElement("Component");
EndElement("DirectoryRef");
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index d7a642d..dc9c636 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -8,7 +8,7 @@
#include "cmWIXPatch.h"
#include "cmWIXShortcut.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
/** \class cmWIXFilesSourceWriter
* \brief Helper class to generate files.wxs
diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx
index 7c48653..287a644 100644
--- a/Source/CPack/WiX/cmWIXPatch.cxx
+++ b/Source/CPack/WiX/cmWIXPatch.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXPatch.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
cmWIXPatch::cmWIXPatch(cmCPackLog* logger)
: Logger(logger)
@@ -29,7 +29,11 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
return;
const cmWIXPatchElement& fragment = i->second;
-
+ for (cmWIXPatchElement::attributes_t::const_iterator attr_i =
+ fragment.attributes.begin();
+ attr_i != fragment.attributes.end(); ++attr_i) {
+ writer.AddAttribute(attr_i->first, attr_i->second);
+ }
this->ApplyElementChildren(fragment, writer);
Fragments.erase(i);
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
index 47f98d1..0dcc74a 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.cxx
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXPatchParser.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
-#include <cm_expat.h>
+#include "cm_expat.h"
cmWIXPatchNode::Type cmWIXPatchText::type()
{
@@ -72,9 +72,11 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
void cmWIXPatchParser::StartFragment(const char** attributes)
{
+ cmWIXPatchElement* new_element = CM_NULLPTR;
+ /* find the id of for fragment */
for (size_t i = 0; attributes[i]; i += 2) {
- std::string key = attributes[i];
- std::string value = attributes[i + 1];
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
if (key == "Id") {
if (Fragments.find(value) != Fragments.end()) {
@@ -83,10 +85,22 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
ReportValidationError(tmp.str());
}
- ElementStack.push_back(&Fragments[value]);
- } else {
- ReportValidationError(
- "The only allowed 'CPackWixFragment' attribute is 'Id'");
+ new_element = &Fragments[value];
+ ElementStack.push_back(new_element);
+ }
+ }
+
+ /* add any additional attributes for the fragement */
+ if (!new_element) {
+ ReportValidationError("No 'Id' specified for 'CPackWixFragment' element");
+ } else {
+ for (size_t i = 0; attributes[i]; i += 2) {
+ const std::string key = attributes[i];
+ const std::string value = attributes[i + 1];
+
+ if (key != "Id") {
+ new_element->attributes[key] = value;
+ }
}
}
}
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index a2f0a3c..52c7e35 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -3,12 +3,12 @@
#ifndef cmCPackWIXPatchParser_h
#define cmCPackWIXPatchParser_h
-#include <CPack/cmCPackLog.h>
+#include "cmCPackLog.h"
-#include <cmXMLParser.h>
+#include "cmXMLParser.h"
-#include <list>
#include <map>
+#include <vector>
struct cmWIXPatchNode
{
@@ -36,7 +36,7 @@ struct cmWIXPatchElement : cmWIXPatchNode
~cmWIXPatchElement();
- typedef std::list<cmWIXPatchNode*> child_list_t;
+ typedef std::vector<cmWIXPatchNode*> child_list_t;
typedef std::map<std::string, std::string> attributes_t;
std::string name;
@@ -84,7 +84,7 @@ private:
fragment_map_t& Fragments;
- std::list<cmWIXPatchElement*> ElementStack;
+ std::vector<cmWIXPatchElement*> ElementStack;
};
#endif
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
index d819347..2c99a22 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXRichTextFormatWriter.h"
-#include <cmVersion.h>
+#include "cmVersion.h"
cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter(
std::string const& filename)
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
index a3c8394..30df878 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
@@ -3,9 +3,9 @@
#ifndef cmWIXRichTextFormatWriter_h
#define cmWIXRichTextFormatWriter_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
-#include <cmsys/FStream.hxx>
+#include "cmsys/FStream.hxx"
#include <string>
/** \class cmWIXRichtTextFormatWriter
diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h
index cba3b34..23ddc6a 100644
--- a/Source/CPack/WiX/cmWIXShortcut.h
+++ b/Source/CPack/WiX/cmWIXShortcut.h
@@ -3,7 +3,7 @@
#ifndef cmWIXShortcut_h
#define cmWIXShortcut_h
-#include <cmInstalledFile.h>
+#include "cmInstalledFile.h"
#include <map>
#include <set>
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx
index b434334..a86e28d 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXSourceWriter.h"
-#include <CPack/cmCPackGenerator.h>
+#include "cmCPackGenerator.h"
-#include <cmUuid.h>
+#include "cmUuid.h"
#include <windows.h>
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index 45aefe5..4af1ed6 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -3,9 +3,9 @@
#ifndef cmWIXSourceWriter_h
#define cmWIXSourceWriter_h
-#include <CPack/cmCPackLog.h>
+#include "cmCPackLog.h"
-#include <cmsys/FStream.hxx>
+#include "cmsys/FStream.hxx"
#include <string>
#include <vector>
diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h
index a617d9b..42a4781 100644
--- a/Source/CPack/cmCPack7zGenerator.h
+++ b/Source/CPack/cmCPack7zGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPack7zGenerator_h
#define cmCPack7zGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 9d9cd66..cc01b0c 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -7,6 +7,7 @@
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
+#include "cmWorkingDirectory.h"
#include <map>
#include <ostream>
@@ -37,9 +38,8 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
// Add the files of this component to the archive
std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
localToplevel += "/" + component->Name;
- std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
// Change to local toplevel
- cmSystemTools::ChangeDirectory(localToplevel);
+ cmWorkingDirectory workdir(localToplevel);
std::string filePrefix;
if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) {
filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME");
@@ -64,8 +64,6 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
return 0;
}
}
- // Go back to previous dir
- cmSystemTools::ChangeDirectory(dir);
return 1;
}
@@ -227,8 +225,7 @@ int cmCPackArchiveGenerator::PackageFiles()
// CASE 3 : NON COMPONENT package.
DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0], archive);
std::vector<std::string>::const_iterator fileIt;
- std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
- cmSystemTools::ChangeDirectory(toplevel);
+ cmWorkingDirectory workdir(toplevel);
for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
// Get the relative path to the file
std::string rp =
@@ -241,7 +238,6 @@ int cmCPackArchiveGenerator::PackageFiles()
return 0;
}
}
- cmSystemTools::ChangeDirectory(dir);
// The destructor of cmArchiveWrite will close and finish the write
return 1;
}
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index df02ae8..58d67e3 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackArchiveGenerator_h
#define cmCPackArchiveGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h
index c9200c1..861fe4b 100644
--- a/Source/CPack/cmCPackBundleGenerator.h
+++ b/Source/CPack/cmCPackBundleGenerator.h
@@ -3,7 +3,8 @@
#ifndef cmCPackBundleGenerator_h
#define cmCPackBundleGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
+
#include <string>
#include "cmCPackDragNDropGenerator.h"
diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h
index f955daf..26d69ba 100644
--- a/Source/CPack/cmCPackComponentGroup.h
+++ b/Source/CPack/cmCPackComponentGroup.h
@@ -3,7 +3,7 @@
#ifndef cmCPackComponentGroup_h
#define cmCPackComponentGroup_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include <string>
#include <vector>
@@ -78,6 +78,10 @@ public:
/// contains the files that are part of this component.
std::string ArchiveFile;
+ /// The file to pass to --component-plist when using the
+ /// productbuild generator.
+ std::string Plist;
+
/// The components that this component depends on.
std::vector<cmCPackComponent*> Dependencies;
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
index e67811d..2119f78 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
@@ -9,7 +9,7 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include <cmsys/SystemTools.hxx>
+#include "cmsys/SystemTools.hxx"
cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
{
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
index 92475d9..2c289f6 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -9,13 +9,13 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include <cmsys/SystemTools.hxx>
+#include "cmsys/SystemTools.hxx"
// Includes needed for implementation of RenameFile. This is not in
// system tools because it is not implemented robustly enough to move
// files across directories.
#ifdef _WIN32
-#include <sys/stat.h>
+#include "cm_sys_stat.h"
#include <windows.h>
#endif
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 5c50da8..af54fce 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -8,15 +8,15 @@
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
+#include "cm_sys_stat.h"
-#include <cmsys/Glob.hxx>
+#include "cmsys/Glob.hxx"
#include <limits.h>
#include <map>
#include <ostream>
#include <set>
#include <stdio.h>
#include <string.h>
-#include <sys/stat.h>
#include <utility>
// NOTE:
diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h
index 7db933e..e7cde11 100644
--- a/Source/CPack/cmCPackDebGenerator.h
+++ b/Source/CPack/cmCPackDebGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackDebGenerator_h
#define cmCPackDebGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index fd67df9..9864cf3 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -7,8 +7,8 @@
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
-#include <cmsys/FStream.hxx>
-#include <cmsys/RegularExpression.hxx>
+#include "cmsys/FStream.hxx"
+#include "cmsys/RegularExpression.hxx"
#include <iomanip>
#include <map>
#include <stdlib.h>
@@ -390,6 +390,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
bool remount_image =
!cpack_package_icon.empty() || !cpack_dmg_ds_store_setup_script.empty();
+ std::string temp_image_format = "UDZO";
+
// Create 1 MB dummy padding file in staging area when we need to remount
// image, so we have enough space for storing changes ...
if (remount_image) {
@@ -401,6 +403,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
return 0;
}
+ temp_image_format = "UDRW";
}
// Create a temporary read-write disk image ...
@@ -413,7 +416,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
temp_image_command << " -ov";
temp_image_command << " -srcfolder \"" << staging.str() << "\"";
temp_image_command << " -volname \"" << cpack_dmg_volume_name << "\"";
- temp_image_command << " -format UDRW";
+ temp_image_command << " -format " << temp_image_format;
temp_image_command << " \"" << temp_image << "\"";
if (!this->RunCommand(temp_image_command)) {
@@ -632,29 +635,33 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
return 0;
}
- // convert to UDCO
- std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
- temp_udco += "/temp-udco.dmg";
+ if (temp_image_format != "UDZO") {
+ temp_image_format = "UDZO";
+ // convert to UDZO to enable unflatten/flatten
+ std::string temp_udzo = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+ temp_udzo += "/temp-udzo.dmg";
- std::ostringstream udco_image_command;
- udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
- udco_image_command << " convert \"" << temp_image << "\"";
- udco_image_command << " -format UDCO";
- udco_image_command << " -ov -o \"" << temp_udco << "\"";
+ std::ostringstream udco_image_command;
+ udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
+ udco_image_command << " convert \"" << temp_image << "\"";
+ udco_image_command << " -format UDZO";
+ udco_image_command << " -ov -o \"" << temp_udzo << "\"";
- if (!this->RunCommand(udco_image_command, &error)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Error converting to UDCO dmg for adding SLA."
- << std::endl
- << error << std::endl);
- return 0;
+ if (!this->RunCommand(udco_image_command, &error)) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error converting to UDCO dmg for adding SLA."
+ << std::endl
+ << error << std::endl);
+ return 0;
+ }
+ temp_image = temp_udzo;
}
// unflatten dmg
std::ostringstream unflatten_command;
unflatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
unflatten_command << " unflatten ";
- unflatten_command << "\"" << temp_udco << "\"";
+ unflatten_command << "\"" << temp_image << "\"";
if (!this->RunCommand(unflatten_command, &error)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -673,7 +680,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
}
embed_sla_command << " \"" << sla_r << "\"";
embed_sla_command << " -a -o ";
- embed_sla_command << "\"" << temp_udco << "\"";
+ embed_sla_command << "\"" << temp_image << "\"";
if (!this->RunCommand(embed_sla_command, &error)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error adding SLA." << std::endl
@@ -686,7 +693,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::ostringstream flatten_command;
flatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
flatten_command << " flatten ";
- flatten_command << "\"" << temp_udco << "\"";
+ flatten_command << "\"" << temp_image << "\"";
if (!this->RunCommand(flatten_command, &error)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -695,8 +702,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
<< std::endl);
return 0;
}
-
- temp_image = temp_udco;
}
// Create the final compressed read-only disk image ...
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index 876eab7..ae2cc17 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -3,7 +3,8 @@
#ifndef cmCPackDragNDropGenerator_h
#define cmCPackDragNDropGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
+
#include <sstream>
#include <stddef.h>
#include <string>
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 21eda79..3e113d3 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -2,11 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackGenerator.h"
+#include "cmsys/FStream.hxx"
+#include "cmsys/Glob.hxx"
+#include "cmsys/RegularExpression.hxx"
#include <algorithm>
-#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/RegularExpression.hxx>
-#include <list>
#include <utility>
#include "cmCPackComponentGroup.h"
@@ -16,6 +15,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmStateSnapshot.h"
+#include "cmWorkingDirectory.h"
#include "cmXMLSafe.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
@@ -313,7 +313,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
const std::string& tempDir = tempInstallDirectory;
for (it = installDirectoriesVector.begin();
it != installDirectoriesVector.end(); ++it) {
- std::list<std::pair<std::string, std::string> > symlinkedFiles;
+ std::vector<std::pair<std::string, std::string> > symlinkedFiles;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string top = *it;
@@ -377,13 +377,14 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
/* rebuild symlinks in the installed tree */
if (!symlinkedFiles.empty()) {
- std::list<std::pair<std::string, std::string> >::iterator symlinkedIt;
+ std::vector<std::pair<std::string, std::string> >::iterator
+ symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
std::string goToDir = tempDir;
goToDir += "/" + subdir;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Change dir to: " << goToDir
<< std::endl);
- cmSystemTools::ChangeDirectory(goToDir);
+ cmWorkingDirectory workdir(goToDir);
for (symlinkedIt = symlinkedFiles.begin();
symlinkedIt != symlinkedFiles.end(); ++symlinkedIt) {
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: "
@@ -408,7 +409,6 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Going back to: " << curDir
<< std::endl);
- cmSystemTools::ChangeDirectory(curDir);
}
}
}
@@ -620,7 +620,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
<< installComponent << std::endl);
}
- cmake cm;
+ cmake cm(cmake::RoleScript);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -795,6 +795,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmsys::Glob glA;
glA.RecurseOn();
glA.SetRecurseListDirs(true);
+ glA.SetRecurseThroughSymlinks(false);
glA.FindFiles(findExpr);
std::vector<std::string> filesAfter = glA.GetFiles();
std::sort(filesAfter.begin(), filesAfter.end());
@@ -1396,6 +1397,11 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
component->ArchiveFile = archiveFile;
}
+ const char* plist = this->GetOption(macroPrefix + "_PLIST");
+ if (plist && *plist) {
+ component->Plist = plist;
+ }
+
const char* groupName = this->GetOption(macroPrefix + "_GROUP");
if (groupName && *groupName) {
component->Group = GetComponentGroup(projectName, groupName);
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 5354fca..45777fa 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackGenerator_h
#define cmCPackGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include <map>
#include <sstream>
@@ -13,25 +13,10 @@
#include "cmCPackComponentGroup.h"
#include "cmSystemTools.h"
-class cmCPackGenerator;
class cmCPackLog;
class cmInstalledFile;
class cmMakefile;
-#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)
-
/** \class cmCPackGenerator
* \brief A superclass of all CPack Generators
*
@@ -312,4 +297,18 @@ 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
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index b012f01..31f48c7 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackGeneratorFactory.h"
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include <ostream>
#include <utility>
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 4ee0bc1..7f633e4 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -3,7 +3,7 @@
#ifndef cmCPackGeneratorFactory_h
#define cmCPackGeneratorFactory_h
-#include <cmConfigure.h> // IWYU pragma: keep
+#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
#include <string>
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index 7d5c192..5c71239 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackLog.h"
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include <iostream>
#include "cmGeneratedFileStream.h"
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index a988ccc..96c5882 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -3,7 +3,7 @@
#ifndef cmCPackLog_h
#define cmCPackLog_h
-#include <cmConfigure.h> // IWYU pragma: keep
+#include "cmConfigure.h" // IWYU pragma: keep
#include <ostream>
#include <string.h>
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 1940953..beb2d01 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -8,9 +8,9 @@
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
+#include "cmsys/Directory.hxx"
+#include "cmsys/RegularExpression.hxx"
#include <algorithm>
-#include <cmsys/Directory.hxx>
-#include <cmsys/RegularExpression.hxx>
#include <map>
#include <sstream>
#include <stdlib.h>
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index b4bf2d4..77be325 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackNSISGenerator_h
#define cmCPackNSISGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 0d8dc48..8ea88a8 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -3,12 +3,12 @@
#include "cmCPackOSXX11Generator.h"
#include <sstream>
-#include <sys/stat.h>
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
+#include "cm_sys_stat.h"
cmCPackOSXX11Generator::cmCPackOSXX11Generator()
{
diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h
index 1918e21..0eebc6d 100644
--- a/Source/CPack/cmCPackOSXX11Generator.h
+++ b/Source/CPack/cmCPackOSXX11Generator.h
@@ -3,7 +3,8 @@
#ifndef cmCPackOSXX11Generator_h
#define cmCPackOSXX11Generator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
+
#include <string>
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
index 1e96a62..f873c59 100644
--- a/Source/CPack/cmCPackPKGGenerator.h
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -3,7 +3,8 @@
#ifndef cmCPackPKGGenerator_h
#define cmCPackPKGGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
+
#include <set>
#include <sstream>
#include <string>
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index 8000d6e..8db7cfb 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -2,9 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackPackageMakerGenerator.h"
+#include "cmsys/FStream.hxx"
+#include "cmsys/RegularExpression.hxx"
#include <assert.h>
-#include <cmsys/FStream.hxx>
-#include <cmsys/RegularExpression.hxx>
#include <map>
#include <sstream>
#include <stdio.h>
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index d4c6744..6274515 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackPackageMakerGenerator_h
#define cmCPackPackageMakerGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackGenerator.h"
#include "cmCPackPKGGenerator.h"
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
index a5a18dc..1389eaa 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.cxx
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -59,12 +59,25 @@ int cmCPackProductBuildGenerator::PackageFiles()
}
}
- // Copy or create all of the resource files we need.
std::string resDir = packageDirFileName + "/Contents";
+
+ if (this->IsSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) {
+ std::string userResDir =
+ this->GetOption("CPACK_PRODUCTBUILD_RESOURCES_DIR");
+
+ if (!cmSystemTools::CopyADirectory(userResDir, resDir)) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
+ << std::endl);
+ return 0;
+ }
+ }
+
+ // Copy or create all of the resource files we need.
if (!this->CopyCreateResourceFile("License", resDir) ||
!this->CopyCreateResourceFile("ReadMe", resDir) ||
!this->CopyCreateResourceFile("Welcome", resDir)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem copying the License, ReadMe and Welcome files"
<< std::endl);
return 0;
}
@@ -223,6 +236,10 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
: " --keychain \"" + keychainPath + "\"")
<< " \"" << packageFile << "\"";
+ if (component && !component->Plist.empty()) {
+ pkgCmd << " --component-plist \"" << component->Plist << "\"";
+ }
+
// Run ProductBuild
return RunProductBuild(pkgCmd.str());
}
diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h
index b6da470..12093a0 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.h
+++ b/Source/CPack/cmCPackProductBuildGenerator.h
@@ -3,7 +3,8 @@
#ifndef cmCPackProductBuildGenerator_h
#define cmCPackProductBuildGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
+
#include <string>
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index 4d48bd8..52cfc13 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackRPMGenerator_h
#define cmCPackRPMGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 682394e..c541614 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -2,19 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackSTGZGenerator.h"
-#include <cmsys/FStream.hxx>
+#include "cmsys/FStream.hxx"
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
-
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmSystemTools.h"
+#include "cm_sys_stat.h"
cmCPackSTGZGenerator::cmCPackSTGZGenerator()
{
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index 4b9c1c6..8304e80 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackSTGZGenerator_h
#define cmCPackSTGZGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackGenerator.h"
#include "cmCPackTGZGenerator.h"
diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h
index ee2e975..9426b3a 100644
--- a/Source/CPack/cmCPackTGZGenerator.h
+++ b/Source/CPack/cmCPackTGZGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackTGZGenerator_h
#define cmCPackTGZGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h
index 876ca7d..3b96e2d 100644
--- a/Source/CPack/cmCPackTXZGenerator.h
+++ b/Source/CPack/cmCPackTXZGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackTXZGenerator_h
#define cmCPackTXZGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h
index 42214fd..9b4b8f4 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.h
+++ b/Source/CPack/cmCPackTarBZip2Generator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackTarBZip2Generator_h
#define cmCPackTarBZip2Generator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h
index 1476642..381d6eb 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.h
+++ b/Source/CPack/cmCPackTarCompressGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackTarCompressGenerator_h
#define cmCPackTarCompressGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h
index 95b6489..00c8720 100644
--- a/Source/CPack/cmCPackZIPGenerator.h
+++ b/Source/CPack/cmCPackZIPGenerator.h
@@ -3,7 +3,7 @@
#ifndef cmCPackZIPGenerator_h
#define cmCPackZIPGenerator_h
-#include <cmConfigure.h>
+#include "cmConfigure.h"
#include "cmCPackArchiveGenerator.h"
#include "cmCPackGenerator.h"
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index af80cbf..a44bc3d 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -1,9 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include <cmConfigure.h>
+#include "cmConfigure.h"
-#include <cmsys/CommandLineArguments.hxx>
-#include <cmsys/Encoding.hxx>
+#include "cmsys/CommandLineArguments.hxx"
+#include "cmsys/Encoding.hxx"
#include <iostream>
#include <map>
#include <sstream>
@@ -13,7 +13,7 @@
#include <vector>
#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
-#include <cmsys/ConsoleBuf.hxx>
+#include "cmsys/ConsoleBuf.hxx"
#endif
#include "cmCPackGenerator.h"
@@ -23,7 +23,6 @@
#include "cmDocumentationEntry.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
@@ -189,11 +188,10 @@ int main(int argc, char const* const* argv)
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack config file: " << cpackConfigFile << std::endl);
- cmake cminst;
+ cmake cminst(cmake::RoleScript);
cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory("");
cminst.GetCurrentSnapshot().SetDefaultDefinitions();
- cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
CM_AUTO_PTR<cmMakefile> globalMF(
new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));