diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index f02b17f23..949f190e9 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 000000000..11f44d0df --- /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 000000000..5e191d08e --- /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 ec59715c7..a2995d1d7 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 3fd959e39..451188ecf 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 13122c269..23ef561e9 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(