diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2011-03-25 16:18:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-03-31 17:33:03 (GMT) |
commit | 64a5e209998f12662a56346f855b1973cbbd0440 (patch) | |
tree | 7c4c071ee6ae358399d0ddfb7ea2b058826d20ca /Source/CPack/cmCPackGenerator.cxx | |
parent | 148b528f9d7d991dc01f277624df4a8aa41feccc (diff) | |
download | CMake-64a5e209998f12662a56346f855b1973cbbd0440.zip CMake-64a5e209998f12662a56346f855b1973cbbd0440.tar.gz CMake-64a5e209998f12662a56346f855b1973cbbd0440.tar.bz2 |
Combine component packaging methods into an enum.
Also allow generators to override the default packaging method.
Add a ONE_PER_GROUP option so that method can be specified by the user without relying on defaults.
Diffstat (limited to 'Source/CPack/cmCPackGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 83 |
1 files changed, 57 insertions, 26 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 691092f..6d71ad2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -36,8 +36,7 @@ cmCPackGenerator::cmCPackGenerator() this->GeneratorVerbose = false; this->MakefileMap = 0; this->Logger = 0; - this->allComponentInOne = false; - this->ignoreComponentGroup = false; + this->componentPackageMethod = ONE_PACKAGE_PER_GROUP; } //---------------------------------------------------------------------- @@ -1263,14 +1262,23 @@ int cmCPackGenerator::CleanTemporaryDirectory() //---------------------------------------------------------------------- int cmCPackGenerator::PrepareGroupingKind() { - // The default behavior is to create 1 package by component group - // unless the user asked to put all COMPONENTS in a single package - allComponentInOne = (NULL != (this->GetOption( - "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE")) - ); - ignoreComponentGroup = (NULL != (this->GetOption( - "CPACK_COMPONENTS_IGNORE_GROUPS")) - ); + // find a component package method specified by the user + ComponentPackageMethod method = UNKNOWN_COMPONENT_PACKAGE_METHOD; + + if(this->GetOption("CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE")) + { + method = ONE_PACKAGE; + } + + if(this->GetOption("CPACK_COMPONENTS_IGNORE_GROUPS")) + { + method = ONE_PACKAGE_PER_COMPONENT; + } + + if(this->GetOption("CPACK_COMPONENTS_ONE_PACKAGE_PER_GROUP")) + { + method = ONE_PACKAGE_PER_GROUP; + } std::string groupingType; @@ -1286,40 +1294,63 @@ int cmCPackGenerator::PrepareGroupingKind() << " requested component grouping = "<< groupingType <<std::endl); if (groupingType == "ALL_COMPONENTS_IN_ONE") { - allComponentInOne = true; + method = ONE_PACKAGE; } else if (groupingType == "IGNORE") { - ignoreComponentGroup = true; + method = ONE_PACKAGE_PER_COMPONENT; + } + else if (groupingType == "ONE_PER_GROUP") + { + method = ONE_PACKAGE_PER_GROUP; } else { cmCPackLogger(cmCPackLog::LOG_WARNING, "[" << this->Name << "]" << " requested component grouping type <"<< groupingType - << "> UNKNOWN not in (ALL_COMPONENTS_IN_ONE,IGNORE)" + << "> UNKNOWN not in (ALL_COMPONENTS_IN_ONE,IGNORE,ONE_PER_GROUP)" << std::endl); } } - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" - << this->Name << "]" - << " requested component grouping = (" - << ", ALL_COMPONENTS_IN_ONE=" << allComponentInOne - << ", IGNORE_GROUPS=" << ignoreComponentGroup - << ")" - << std::endl); // Some components were defined but NO group - // force ignoreGroups - if (this->ComponentGroups.empty() && (!this->Components.empty()) - && (!ignoreComponentGroup)) { + // fallback to default if not group based + if(method == ONE_PACKAGE_PER_GROUP && + this->ComponentGroups.empty() && !this->Components.empty()) + { + if(componentPackageMethod == ONE_PACKAGE) + { + method = ONE_PACKAGE; + } + else + { + method = ONE_PACKAGE_PER_COMPONENT; + } cmCPackLogger(cmCPackLog::LOG_WARNING, "[" << this->Name << "]" - << " Some Components defined but NO component group:" + << " One package per component group requested, but NO component groups exist:" << " Ignoring component group." << std::endl); - ignoreComponentGroup = true; - } + } + + // if user specified packaging method, override the default packaging method + if(method != UNKNOWN_COMPONENT_PACKAGE_METHOD) + { + componentPackageMethod = method; + } + + const char* method_names[] = + { + "ALL_COMPONENTS_IN_ONE", + "IGNORE_GROUPS", + "ONE_PER_GROUP" + }; + + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" + << this->Name << "]" + << " requested component grouping = " << method_names[componentPackageMethod] + << std::endl); return 1; } |