summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorKonstantin Podsvirov <konstantin@podsvirov.pro>2016-11-11 20:51:28 (GMT)
committerKonstantin Podsvirov <konstantin@podsvirov.pro>2016-11-24 14:05:51 (GMT)
commit88ecfd8ba122133777bb71b027df3684689d4e3a (patch)
treecc9b4c4fd394a424bc981e06cd8bc9d383ee85ed /Source/CPack
parent8288d16126193e86bb6880a7d7b749649ad83e2c (diff)
downloadCMake-88ecfd8ba122133777bb71b027df3684689d4e3a.zip
CMake-88ecfd8ba122133777bb71b027df3684689d4e3a.tar.gz
CMake-88ecfd8ba122133777bb71b027df3684689d4e3a.tar.bz2
CPackIFW: Add some options
New options is: DEFAULT, VIRTUAL, FORCED_INSTALLATION, DISPLAY_NAME, DESCRIPTION and RELEASE_DATE. Options added for both cpack_ifw_configure_component and cpack_ifw_configure_component_group command.
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx6
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx82
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx18
-rw-r--r--Source/CPack/cmCPackGenerator.h2
5 files changed, 108 insertions, 3 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 0098a4b..3b68cfc 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -403,7 +403,11 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
// Check package group
if (const char* option = GetOption("CPACK_IFW_PACKAGE_GROUP")) {
package.ConfigureFromGroup(option);
- package.ForcedInstallation = "true";
+ std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" +
+ cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION";
+ if (!GetOption(forcedOption)) {
+ package.ForcedInstallation = "true";
+ }
} else {
package.ConfigureFromOptions();
}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 4d46120..902c85d 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -109,6 +109,16 @@ 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;
@@ -286,7 +296,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
// ForcedInstallation
ForcedInstallation = component->IsRequired ? "true" : "false";
- return 1;
+ return ConfigureFromPrefix(prefix);
}
int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
@@ -344,7 +354,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
SortingPriority = option;
}
- return 1;
+ return ConfigureFromPrefix(prefix);
}
int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
@@ -380,6 +390,74 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
return ConfigureFromGroup(&group);
}
+// Common options for components and groups
+int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
+{
+ // Temporary variable for full option name
+ std::string option;
+
+ // Display name
+ option = prefix + "DISPLAY_NAME";
+ if (IsSetToEmpty(option)) {
+ DisplayName.clear();
+ } else if (const char* value = GetOption(option)) {
+ DisplayName = value;
+ }
+
+ // Description
+ option = prefix + "DESCRIPTION";
+ if (IsSetToEmpty(option)) {
+ Description.clear();
+ } else if (const char* value = GetOption(option)) {
+ Description = value;
+ }
+
+ // Release date
+ option = prefix + "RELEASE_DATE";
+ if (IsSetToEmpty(option)) {
+ ReleaseDate.clear();
+ } else if (const char* value = GetOption(option)) {
+ ReleaseDate = value;
+ }
+
+ // Visibility
+ option = prefix + "VIRTUAL";
+ if (IsSetToEmpty(option)) {
+ Virtual.clear();
+ } else if (IsOn(option)) {
+ Virtual = "true";
+ }
+
+ // Default selection
+ option = prefix + "DEFAULT";
+ if (IsSetToEmpty(option)) {
+ Default.clear();
+ } else if (const char* value = 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";
+ } else {
+ 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";
+ }
+
+ return 1;
+}
+
void cmCPackIFWPackage::GeneratePackageFile()
{
// Lazy directory initialization
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index d1af2bd..76ed540 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -112,6 +112,8 @@ public:
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);
@@ -125,6 +127,7 @@ public:
int ConfigureFromComponent(cmCPackComponent* component);
int ConfigureFromGroup(cmCPackComponentGroup* group);
int ConfigureFromGroup(const std::string& groupName);
+ int ConfigureFromPrefix(const std::string& prefix);
void GeneratePackageFile();
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 09b9c0d..25bb851 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1074,6 +1074,24 @@ bool cmCPackGenerator::IsOn(const std::string& name) const
return cmSystemTools::IsOn(GetOption(name));
}
+bool cmCPackGenerator::IsSetToOff(const std::string& op) const
+{
+ const char* ret = this->MakefileMap->GetDefinition(op);
+ if (ret && *ret) {
+ return cmSystemTools::IsOff(ret);
+ }
+ return false;
+}
+
+bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const
+{
+ const char* ret = this->MakefileMap->GetDefinition(op);
+ if (ret) {
+ return !*ret;
+ }
+ return false;
+}
+
const char* cmCPackGenerator::GetOption(const std::string& op) const
{
const char* ret = this->MakefileMap->GetDefinition(op);
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index f32dd70..5226059 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -91,6 +91,8 @@ public:
std::vector<std::string> GetOptions() const;
bool IsSet(const std::string& name) const;
bool IsOn(const std::string& name) const;
+ bool IsSetToOff(const std::string& op) const;
+ bool IsSetToEmpty(const std::string& op) const;
//! Set the logger
void SetLogger(cmCPackLog* log) { this->Logger = log; }