diff options
author | Erlend E. Aasland <erlend.aasland@innova.no> | 2021-10-08 09:48:42 (GMT) |
---|---|---|
committer | Erlend E. Aasland <erlend.aasland@innova.no> | 2021-10-08 16:31:00 (GMT) |
commit | 5447dc655e94e0987a81b8dbeb37b05667d92992 (patch) | |
tree | 64ac38ce0bf956aaabb366255305c4cd61d8c7d5 /Source/CPack/IFW | |
parent | 3068ea834ff17bd5d2e8438c1a8d3a6331d10f62 (diff) | |
download | CMake-5447dc655e94e0987a81b8dbeb37b05667d92992.zip CMake-5447dc655e94e0987a81b8dbeb37b05667d92992.tar.gz CMake-5447dc655e94e0987a81b8dbeb37b05667d92992.tar.bz2 |
CPackIFW: Add version guard for configuration attributes
Fixes: #22736
Diffstat (limited to 'Source/CPack/IFW')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 163 |
1 files changed, 86 insertions, 77 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 7ee6300..90465d8 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -362,26 +362,6 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.Element("ProductUrl", this->ProductUrl); } - // ApplicationIcon - if (!this->InstallerApplicationIcon.empty()) { - std::string name = - cmSystemTools::GetFilenameName(this->InstallerApplicationIcon); - std::string path = this->Directory + "/config/" + name; - name = cmSystemTools::GetFilenameWithoutExtension(name); - cmsys::SystemTools::CopyFileIfDifferent(this->InstallerApplicationIcon, - path); - xout.Element("InstallerApplicationIcon", name); - } - - // WindowIcon - 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 (!this->Logo.empty()) { std::string name = cmSystemTools::GetFilenameName(this->Logo); @@ -414,42 +394,75 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.Element("Background", name); } - // WizardStyle - if (!this->WizardStyle.empty()) { - xout.Element("WizardStyle", this->WizardStyle); - } + // Attributes introduced in QtIFW 1.4.0 + if (!this->IsVersionLess("1.4")) { + // ApplicationIcon + if (!this->InstallerApplicationIcon.empty()) { + std::string name = + cmSystemTools::GetFilenameName(this->InstallerApplicationIcon); + std::string path = this->Directory + "/config/" + name; + name = cmSystemTools::GetFilenameWithoutExtension(name); + cmsys::SystemTools::CopyFileIfDifferent(this->InstallerApplicationIcon, + path); + xout.Element("InstallerApplicationIcon", name); + } - // Stylesheet - if (!this->StyleSheet.empty()) { - std::string name = cmSystemTools::GetFilenameName(this->StyleSheet); - std::string path = this->Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(this->StyleSheet, path); - xout.Element("StyleSheet", name); + // WindowIcon + 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); + } } - // WizardDefaultWidth - if (!this->WizardDefaultWidth.empty()) { - xout.Element("WizardDefaultWidth", this->WizardDefaultWidth); - } + // Attributes introduced in QtIFW 2.0.0 + if (!this->IsVersionLess("2.0")) { + // WizardDefaultWidth + if (!this->WizardDefaultWidth.empty()) { + xout.Element("WizardDefaultWidth", this->WizardDefaultWidth); + } - // WizardDefaultHeight - if (!this->WizardDefaultHeight.empty()) { - xout.Element("WizardDefaultHeight", this->WizardDefaultHeight); - } + // WizardDefaultHeight + if (!this->WizardDefaultHeight.empty()) { + xout.Element("WizardDefaultHeight", this->WizardDefaultHeight); + } - // WizardShowPageList - if (!this->IsVersionLess("4.0") && !this->WizardShowPageList.empty()) { - xout.Element("WizardShowPageList", this->WizardShowPageList); - } + // Start menu directory + if (!this->StartMenuDir.empty()) { + xout.Element("StartMenuDir", this->StartMenuDir); + } - // TitleColor - if (!this->TitleColor.empty()) { - xout.Element("TitleColor", this->TitleColor); - } + // Maintenance tool + if (!this->MaintenanceToolName.empty()) { + xout.Element("MaintenanceToolName", this->MaintenanceToolName); + } - // Start menu - if (!this->IsVersionLess("2.0")) { - xout.Element("StartMenuDir", this->StartMenuDir); + // Maintenance tool ini file + if (!this->MaintenanceToolIniFile.empty()) { + xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile); + } + + if (!this->AllowNonAsciiCharacters.empty()) { + xout.Element("AllowNonAsciiCharacters", this->AllowNonAsciiCharacters); + } + if (!this->AllowSpaceInPath.empty()) { + xout.Element("AllowSpaceInPath", this->AllowSpaceInPath); + } + + // Control script (copy to config dir) + if (!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); + } + } else { + // CPack IFW default policy + xout.Comment("CPack IFW default policy for QtIFW less 2.0"); + xout.Element("AllowNonAsciiCharacters", "true"); + xout.Element("AllowSpaceInPath", "true"); } // Target dir @@ -471,41 +484,37 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.EndElement(); } - // Maintenance tool - if (!this->IsVersionLess("2.0") && !this->MaintenanceToolName.empty()) { - xout.Element("MaintenanceToolName", this->MaintenanceToolName); - } + // Attributes introduced in QtIFW 3.0.0 + if (!this->IsVersionLess("3.0")) { + // WizardStyle + if (!this->WizardStyle.empty()) { + xout.Element("WizardStyle", this->WizardStyle); + } - // Maintenance tool ini file - if (!this->IsVersionLess("2.0") && !this->MaintenanceToolIniFile.empty()) { - xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile); - } + // Stylesheet (copy to config dir) + if (!this->StyleSheet.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->StyleSheet); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->StyleSheet, path); + xout.Element("StyleSheet", name); + } - if (!this->RemoveTargetDir.empty()) { - xout.Element("RemoveTargetDir", this->RemoveTargetDir); + // TitleColor + if (!this->TitleColor.empty()) { + xout.Element("TitleColor", this->TitleColor); + } } - // Different allows - 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 (!this->AllowNonAsciiCharacters.empty()) { - xout.Element("AllowNonAsciiCharacters", this->AllowNonAsciiCharacters); - } - if (!this->AllowSpaceInPath.empty()) { - xout.Element("AllowSpaceInPath", this->AllowSpaceInPath); + // Attributes introduced in QtIFW 4.0.0 + if (!this->IsVersionLess("4.0")) { + // WizardShowPageList + if (!this->WizardShowPageList.empty()) { + xout.Element("WizardShowPageList", this->WizardShowPageList); } } - // Control script (copy to config dir) - 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); + if (!this->RemoveTargetDir.empty()) { + xout.Element("RemoveTargetDir", this->RemoveTargetDir); } // Resources (copy to resources dir) |