From e6731f486e466ddd58550851fb935dbda7939cac Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 21 Feb 2015 18:07:36 +0100 Subject: CPackWIX: Add new CPACK_STARTUP_SHORTCUTS property. --- Help/manual/cmake-properties.7.rst | 1 + Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst | 7 +++++++ Source/CPack/WiX/cmCPackWIXGenerator.cxx | 20 ++++++++++++++++++++ Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx | 8 ++++++++ Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h | 2 ++ Source/CPack/WiX/cmWIXShortcut.cxx | 7 +++++++ Source/CPack/WiX/cmWIXShortcut.h | 3 ++- 7 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index e3be399..19fdf23 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -324,6 +324,7 @@ Properties on Installed Files /prop_inst/CPACK_NEVER_OVERWRITE.rst /prop_inst/CPACK_PERMANENT.rst /prop_inst/CPACK_START_MENU_SHORTCUTS.rst + /prop_inst/CPACK_STARTUP_SHORTCUTS.rst /prop_inst/CPACK_WIX_ACL.rst diff --git a/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst new file mode 100644 index 0000000..8a16022 --- /dev/null +++ b/Help/prop_inst/CPACK_STARTUP_SHORTCUTS.rst @@ -0,0 +1,7 @@ +CPACK_STARTUP_SHORTCUTS +----------------------- + +Species a list of shortcut names that should be created in the Startup folder +for this file. + +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 c6daeda..4b8daf8 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -557,6 +557,12 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() directoryDefinitions.EmitDesktopFolder(); } + if(emittedShortcutTypes.find(cmWIXShortcuts::STARTUP) != + emittedShortcutTypes.end()) + { + directoryDefinitions.EmitStartupFolder(); + } + directoryDefinitions.EndElement("Directory"); directoryDefinitions.EndElement("Fragment"); @@ -714,6 +720,17 @@ bool cmCPackWIXGenerator::CreateShortcuts( } } + if(!shortcuts.empty(cmWIXShortcuts::STARTUP)) + { + if(!this->CreateShortcutsOfSpecificType(cmWIXShortcuts::STARTUP, + cpackComponentName, featureId, "STARTUP", + shortcuts, false, + fileDefinitions, featureDefinitions)) + { + return false; + } + } + return true; } @@ -736,6 +753,9 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( case cmWIXShortcuts::DESKTOP: directoryId = "DesktopFolder"; break; + case cmWIXShortcuts::STARTUP: + directoryId = "StartupFolder"; + break; default: return false; } diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index a93f89b..7bd4315 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -41,6 +41,14 @@ void cmWIXDirectoriesSourceWriter::EmitDesktopFolder() EndElement("Directory"); } +void cmWIXDirectoriesSourceWriter::EmitStartupFolder() +{ + BeginElement("Directory"); + AddAttribute("Id", "StartupFolder"); + AddAttribute("Name", "Startup"); + EndElement("Directory"); +} + size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory( std::string const& programFilesFolderId, std::string const& installRootString) diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h index f51fdb4..f8c8166 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -32,6 +32,8 @@ public: void EmitDesktopFolder(); + void EmitStartupFolder(); + size_t BeginInstallationPrefixDirectory( std::string const& programFilesFolderId, std::string const& installRootString); diff --git a/Source/CPack/WiX/cmWIXShortcut.cxx b/Source/CPack/WiX/cmWIXShortcut.cxx index aef2b08..d721872 100644 --- a/Source/CPack/WiX/cmWIXShortcut.cxx +++ b/Source/CPack/WiX/cmWIXShortcut.cxx @@ -52,6 +52,10 @@ bool cmWIXShortcuts::EmitShortcuts( shortcutPrefix = "CM_DS"; registrySuffix = "_desktop"; break; + case STARTUP: + shortcutPrefix = "CM_SS"; + registrySuffix = "_startup"; + break; default: return false; } @@ -96,6 +100,9 @@ void cmWIXShortcuts::CreateFromProperties( CreateFromProperty("CPACK_DESKTOP_SHORTCUTS", DESKTOP, id, directoryId, installedFile); + + CreateFromProperty("CPACK_STARTUP_SHORTCUTS", + STARTUP, id, directoryId, installedFile); } void cmWIXShortcuts::CreateFromProperty( diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h index 5e18bdd..5945e43 100644 --- a/Source/CPack/WiX/cmWIXShortcut.h +++ b/Source/CPack/WiX/cmWIXShortcut.h @@ -34,7 +34,8 @@ public: enum Type { START_MENU, - DESKTOP + DESKTOP, + STARTUP }; typedef std::vector shortcut_list_t; -- cgit v0.12