diff options
author | Julien Marrec <julien.marrec@gmail.com> | 2024-09-05 15:03:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-09-11 12:44:09 (GMT) |
commit | 3331c7032f474515c5f207afb8ed978293d26a0b (patch) | |
tree | e1f72d55360308b89b04d57ae01e035c0416940d /Source/CPack | |
parent | d58f90f628ebae57de7c7709fe30869a03489063 (diff) | |
download | CMake-3331c7032f474515c5f207afb8ed978293d26a0b.zip CMake-3331c7032f474515c5f207afb8ed978293d26a0b.tar.gz CMake-3331c7032f474515c5f207afb8ed978293d26a0b.tar.bz2 |
CPack/IFW: Add option for ProductImages URLs
Add a `CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLS` variable for them.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 26 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.h | 4 |
2 files changed, 29 insertions, 1 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index e729538..f2d7f1c 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -323,6 +323,25 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->ProductImages.end()); } + if (!this->ProductImages.empty()) { + if (cmValue productUrls = + this->GetOption("CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLS")) { + this->ProductImageUrls.clear(); + cmExpandList(productUrls, this->ProductImageUrls); + if (this->ProductImageUrls.size() != this->ProductImages.size()) { + cmCPackIFWLogger( + WARNING, + "Option \"CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLS\" will be skipped " + "because it contains " + << this->ProductImageUrls.size() + << " elements while \"CPACK_IFW_PACKAGE_PRODUCT_IMAGES\" " + "contains " + << this->ProductImages.size() << " elements." << std::endl); + this->ProductImageUrls.clear(); + } + } + } + // Run program, run program arguments, and run program description if (cmValue program = this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM")) { this->RunProgram = *program; @@ -621,12 +640,17 @@ void cmCPackIFWInstaller::GenerateInstallerFile() // Product images (copy to config dir) if (!this->IsVersionLess("4.0") && !this->ProductImages.empty()) { xout.StartElement("ProductImages"); - for (auto const& srcImg : this->ProductImages) { + const bool hasProductImageUrl = !this->ProductImageUrls.empty(); + for (size_t i = 0; i < this->ProductImages.size(); ++i) { xout.StartElement("ProductImage"); + auto const& srcImg = this->ProductImages[i]; std::string name = cmSystemTools::GetFilenameName(srcImg); std::string dstImg = this->Directory + "/config/" + name; cmsys::SystemTools::CopyFileIfDifferent(srcImg, dstImg); xout.Element("Image", name); + if (hasProductImageUrl) { + xout.Element("Url", this->ProductImageUrls.at(i)); + } xout.EndElement(); // </ProductImage> } xout.EndElement(); // </ProductImages> diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 205835b..fb980d7 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -124,6 +124,10 @@ public: /// A list of images to be shown on PerformInstallationPage. std::vector<std::string> ProductImages; + /// A list of associated URLs linked to images to be shown on + /// PerformInstallationPage. + std::vector<std::string> ProductImageUrls; + /// Command executed after the installer is done if the user accepts the /// action std::string RunProgram; |