From d0b1d2a65be658663ce7314961e13036974f62e7 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 16 May 2014 22:43:56 +0200 Subject: CPackWiX: Implement CPACK_NEVER_OVERWRITE and CPACK_PERMANENT properties --- Help/manual/cmake-properties.7.rst | 3 +++ Help/prop_inst/CPACK_NEVER_OVERWRITE.rst | 6 ++++++ Help/prop_inst/CPACK_PERMANENT.rst | 6 ++++++ Source/CPack/WiX/cmCPackWIXGenerator.cxx | 6 +++++- Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 17 ++++++++++++++++- Source/CPack/WiX/cmWIXFilesSourceWriter.h | 3 ++- 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 Help/prop_inst/CPACK_NEVER_OVERWRITE.rst create mode 100644 Help/prop_inst/CPACK_PERMANENT.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index f02b17f..949f190 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -308,3 +308,6 @@ Properties on Installed Files .. toctree:: :maxdepth: 1 + + /prop_inst/CPACK_NEVER_OVERWRITE.rst + /prop_inst/CPACK_PERMANENT.rst diff --git a/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst b/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst new file mode 100644 index 0000000..11f44d0 --- /dev/null +++ b/Help/prop_inst/CPACK_NEVER_OVERWRITE.rst @@ -0,0 +1,6 @@ +CPACK_NEVER_OVERWRITE +--------------------- + +Request that this file not be overwritten on install or reinstall. + +The property is currently only supported by the WIX generator. diff --git a/Help/prop_inst/CPACK_PERMANENT.rst b/Help/prop_inst/CPACK_PERMANENT.rst new file mode 100644 index 0000000..5e191d0 --- /dev/null +++ b/Help/prop_inst/CPACK_PERMANENT.rst @@ -0,0 +1,6 @@ +CPACK_PERMANENT +--------------- + +Request that this file not be removed on uninstall. + +The property is currently only supported by the WIX generator. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index ec59715..a2995d1 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -871,8 +872,11 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( } else { + cmInstalledFile const* installedFile = + this->GetInstalledFile(relativePath); + std::string componentId = fileDefinitions.EmitComponentFile( - directoryId, id, fullPath, *(this->Patch)); + directoryId, id, fullPath, *(this->Patch), installedFile); featureDefinitions.EmitComponentRef(componentId); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index 3fd959e..451188e 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -12,6 +12,8 @@ #include "cmWIXFilesSourceWriter.h" +#include + #include #include @@ -135,7 +137,8 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string const& directoryId, std::string const& id, std::string const& filePath, - cmWIXPatch &patch) + cmWIXPatch &patch, + cmInstalledFile const* installedFile) { std::string componentId = std::string("CM_C") + id; std::string fileId = std::string("CM_F") + id; @@ -147,6 +150,18 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( AddAttribute("Id", componentId); AddAttribute("Guid", "*"); + if(installedFile) + { + if(installedFile->GetPropertyAsBool("CPACK_NEVER_OVERWRITE")) + { + AddAttribute("NeverOverwrite", "yes"); + } + if(installedFile->GetPropertyAsBool("CPACK_PERMANENT")) + { + AddAttribute("Permanent", "yes"); + } + } + BeginElement("File"); AddAttribute("Id", fileId); AddAttribute("Source", filePath); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index 13122c2..23ef561 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -53,7 +53,8 @@ public: std::string const& directoryId, std::string const& id, std::string const& filePath, - cmWIXPatch &patch); + cmWIXPatch &patch, + cmInstalledFile const* installedFile); private: void EmitInstallRegistryValue( -- cgit v0.12