summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-13 13:53:16 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-13 13:53:41 (GMT)
commit0b8c0b26ce076952bfdc0392d2c93c3597974c9f (patch)
treed42a7e06a3b25e9a4983ee402aa582cd9110ec81
parentbacb50afa9ed7806a8900ab7524f2f4a4cd7d669 (diff)
parentd69457077d021b7d4ea10bf2201da61222966c92 (diff)
downloadCMake-0b8c0b26ce076952bfdc0392d2c93c3597974c9f.zip
CMake-0b8c0b26ce076952bfdc0392d2c93c3597974c9f.tar.gz
CMake-0b8c0b26ce076952bfdc0392d2c93c3597974c9f.tar.bz2
Merge topic 'cpack-wix-start-menu'
d69457077d CPackWIX: Allow omitting program menu folder and uninstall shortcut Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3802
-rw-r--r--Help/cpack_gen/wix.rst4
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx35
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx10
3 files changed, 37 insertions, 12 deletions
diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst
index dde4943..7fb5a12 100644
--- a/Help/cpack_gen/wix.rst
+++ b/Help/cpack_gen/wix.rst
@@ -95,6 +95,10 @@ Windows using WiX.
If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME
+ If this variable is set to ``.``, then application shortcuts will be
+ created directly in the start menu and the uninstaller shortcut will be
+ omitted.
+
.. variable:: CPACK_WIX_CULTURES
Language(s) of the installer
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index b0b2df2..f784832 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -537,9 +537,16 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
}
}
- bool emitUninstallShortcut =
- emittedShortcutTypes.find(cmWIXShortcuts::START_MENU) !=
- emittedShortcutTypes.end();
+ bool emitUninstallShortcut = true;
+ const char* cpackWixProgramMenuFolder =
+ GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
+ if (cpackWixProgramMenuFolder &&
+ cm::string_view(cpackWixProgramMenuFolder) == ".") {
+ emitUninstallShortcut = false;
+ } else if (emittedShortcutTypes.find(cmWIXShortcuts::START_MENU) ==
+ emittedShortcutTypes.end()) {
+ emitUninstallShortcut = false;
+ }
if (!CreateShortcuts(std::string(), "ProductFeature", globalShortcuts,
emitUninstallShortcut, fileDefinitions,
@@ -733,9 +740,16 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
{
std::string directoryId;
switch (type) {
- case cmWIXShortcuts::START_MENU:
- directoryId = "PROGRAM_MENU_FOLDER";
- break;
+ case cmWIXShortcuts::START_MENU: {
+ const char* cpackWixProgramMenuFolder =
+ GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
+ if (cpackWixProgramMenuFolder &&
+ cm::string_view(cpackWixProgramMenuFolder) == ".") {
+ directoryId = "ProgramMenuFolder";
+ } else {
+ directoryId = "PROGRAM_MENU_FOLDER";
+ }
+ } break;
case cmWIXShortcuts::DESKTOP:
directoryId = "DesktopFolder";
break;
@@ -789,8 +803,13 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
fileDefinitions);
if (type == cmWIXShortcuts::START_MENU) {
- fileDefinitions.EmitRemoveFolder("CM_REMOVE_PROGRAM_MENU_FOLDER" +
- idSuffix);
+ const char* cpackWixProgramMenuFolder =
+ GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
+ if (cpackWixProgramMenuFolder &&
+ cm::string_view(cpackWixProgramMenuFolder) != ".") {
+ fileDefinitions.EmitRemoveFolder("CM_REMOVE_PROGRAM_MENU_FOLDER" +
+ idSuffix);
+ }
}
if (emitUninstallShortcut) {
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
index 975dffb..0a83ca2 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
@@ -14,10 +14,12 @@ void cmWIXDirectoriesSourceWriter::EmitStartMenuFolder(
BeginElement("Directory");
AddAttribute("Id", "ProgramMenuFolder");
- BeginElement("Directory");
- AddAttribute("Id", "PROGRAM_MENU_FOLDER");
- AddAttribute("Name", startMenuFolder);
- EndElement("Directory");
+ if (startMenuFolder != ".") {
+ BeginElement("Directory");
+ AddAttribute("Id", "PROGRAM_MENU_FOLDER");
+ AddAttribute("Name", startMenuFolder);
+ EndElement("Directory");
+ }
EndElement("Directory");
}