From e785fab54b17349f01bc791d808de3319a30d95a Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 19 Sep 2014 22:42:36 +0200 Subject: [PATCH] CPackWiX: Teach WiX installers to remember the install location for upgrades --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index a2995d1d7..b221ab43b 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -360,6 +360,29 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() includeFile.EndElement("Property"); } } + + if(GetOption("CPACK_WIX_PROPERTY_ARPINSTALLLOCATION") == 0) + { + includeFile.BeginElement("Property"); + includeFile.AddAttribute("Id", "INSTALL_ROOT"); + includeFile.AddAttribute("Secure", "yes"); + + includeFile.BeginElement("RegistrySearch"); + includeFile.AddAttribute("Id", "FindInstallLocation"); + includeFile.AddAttribute("Root", "HKLM"); + includeFile.AddAttribute("Key", "Software\\Microsoft\\Windows\\" + "CurrentVersion\\Uninstall\\[WIX_UPGRADE_DETECTED]"); + includeFile.AddAttribute("Name", "InstallLocation"); + includeFile.AddAttribute("Type", "raw"); + includeFile.EndElement("RegistrySearch"); + includeFile.EndElement("Property"); + + includeFile.BeginElement("SetProperty"); + includeFile.AddAttribute("Id", "ARPINSTALLLOCATION"); + includeFile.AddAttribute("Value", "[INSTALL_ROOT]"); + includeFile.AddAttribute("After", "CostFinalize"); + includeFile.EndElement("SetProperty"); + } } void cmCPackWIXGenerator::CopyDefinition(