| 416 | } while (false) |
| 417 | |
| 418 | int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) |
| 419 | { |
| 420 | this->packageFileNames.clear(); |
| 421 | // The default behavior is to have one package by component group |
| 422 | // unless CPACK_COMPONENTS_IGNORE_GROUP is specified. |
| 423 | if (!ignoreGroup) { |
| 424 | for (auto const& compG : this->ComponentGroups) { |
| 425 | cmCPackLogger(cmCPackLog::LOG_VERBOSE, |
| 426 | "Packaging component group: " << compG.first << std::endl); |
| 427 | // Begin the archive for this group |
| 428 | std::string packageFileName = std::string(this->toplevel) + "/" + |
| 429 | this->GetArchiveComponentFileName(compG.first, true); |
| 430 | |
| 431 | Deduplicator deduplicator; |
| 432 | |
| 433 | // open a block in order to automatically close archive |
| 434 | // at the end of the block |
| 435 | { |
| 436 | DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive); |
| 437 | // now iterate over the component of this group |
| 438 | for (cmCPackComponent* comp : (compG.second).Components) { |
| 439 | // Add the files of this component to the archive |
| 440 | this->addOneComponentToArchive(archive, comp, &deduplicator); |
| 441 | } |
| 442 | } |
| 443 | // add the generated package to package file names list |
| 444 | this->packageFileNames.push_back(std::move(packageFileName)); |
| 445 | } |
| 446 | // Handle Orphan components (components not belonging to any groups) |
| 447 | for (auto& comp : this->Components) { |
| 448 | // Does the component belong to a group? |
| 449 | if (!comp.second.Group) { |
| 450 | cmCPackLogger( |
| 451 | cmCPackLog::LOG_VERBOSE, |
| 452 | "Component <" |
| 453 | << comp.second.Name |
| 454 | << "> does not belong to any group, package it separately." |
| 455 | << std::endl); |
| 456 | std::string packageFileName = std::string(this->toplevel); |
| 457 | packageFileName += |
| 458 | "/" + this->GetArchiveComponentFileName(comp.first, false); |
| 459 | |
| 460 | { |
| 461 | DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive); |
| 462 | // Add the files of this component to the archive |
| 463 | this->addOneComponentToArchive(archive, &(comp.second), nullptr); |
| 464 | } |
| 465 | // add the generated package to package file names list |
| 466 | this->packageFileNames.push_back(std::move(packageFileName)); |
| 467 | } |
| 468 | } |
| 469 | } |
| 470 | // CPACK_COMPONENTS_IGNORE_GROUPS is set |
| 471 | // We build 1 package per component |
| 472 | else { |
| 473 | for (auto& comp : this->Components) { |
| 474 | std::string packageFileName = std::string(this->toplevel); |
| 475 | packageFileName += |
no test coverage detected