Sfoglia il codice sorgente

CPack/IFW: Add option to control deletion of the install directory

Added support for QT IFW "RemoveTargetDir" boolean option.  QTIFW
supports an option to prevent, or not, deletion of the installation
directory. This is a direct pass-through to that variable.
Jean-Philippe Lebel 9 anni fa
parent
commit
739ae1d090

+ 6 - 0
Help/release/dev/cpackifw-package-remove-target-dir.rst

@@ -0,0 +1,6 @@
+cpackifw-package-remove-target-dir
+----------------------------------
+
+* The :module:`CPackIFW` module gained new
+  :variable:`CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR` variable to control
+  if the target directory should not be deleted when uninstalling.

+ 6 - 0
Modules/CPackIFW.cmake

@@ -191,6 +191,12 @@
 #
 #
 #  By default used QtIFW_ defaults (``maintenancetool``).
 #  By default used QtIFW_ defaults (``maintenancetool``).
 #
 #
+# .. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR
+#
+#  Set to ``OFF`` if the target directory should not be deleted when uninstalling.
+#
+#  Is ``ON`` by default
+#
 # .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE
 # .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE
 #
 #
 #  Filename for the configuration of the generated maintenance tool.
 #  Filename for the configuration of the generated maintenance tool.

+ 13 - 0
Source/CPack/IFW/cmCPackIFWInstaller.cxx

@@ -93,6 +93,15 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
     }
     }
   }
   }
 
 
+  // RemoveTargetDir
+  if (this->IsSetToOff("CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR")) {
+    this->RemoveTargetDir = "false";
+  } else if (this->IsOn("CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR")) {
+    this->RemoveTargetDir = "true";
+  } else {
+    this->RemoveTargetDir.clear();
+  }
+
   // Logo
   // Logo
   if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) {
   if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) {
     if (cmSystemTools::FileExists(option)) {
     if (cmSystemTools::FileExists(option)) {
@@ -422,6 +431,10 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
     xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile);
     xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile);
   }
   }
 
 
+  if (!this->RemoveTargetDir.empty()) {
+    xout.Element("RemoveTargetDir", this->RemoveTargetDir);
+  }
+
   // Different allows
   // Different allows
   if (this->IsVersionLess("2.0")) {
   if (this->IsVersionLess("2.0")) {
     // CPack IFW default policy
     // CPack IFW default policy

+ 4 - 0
Source/CPack/IFW/cmCPackIFWInstaller.h

@@ -99,6 +99,10 @@ public:
   /// Set to true if the installation path can contain non-ASCII characters
   /// Set to true if the installation path can contain non-ASCII characters
   std::string AllowNonAsciiCharacters;
   std::string AllowNonAsciiCharacters;
 
 
+  /// Set to false if the target directory should not be deleted when
+  /// uninstalling
+  std::string RemoveTargetDir;
+
   /// Set to false if the installation path cannot contain space characters
   /// Set to false if the installation path cannot contain space characters
   std::string AllowSpaceInPath;
   std::string AllowSpaceInPath;