From 8600980c39aaf0e27e13709e2cb08aef12e3c92a Mon Sep 17 00:00:00 2001
From: David Golub <golubdr@gmail.com>
Date: Fri, 2 Aug 2013 11:08:32 -0400
Subject: [PATCH] CPack/NSIS: Add support for custom pages and initialization
 commands.

---
 Modules/CPackNSIS.cmake  | 12 ++++++++++++
 Modules/NSIS.template.in |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake
index d140053..a48e62f 100644
--- a/Modules/CPackNSIS.cmake
+++ b/Modules/CPackNSIS.cmake
@@ -49,6 +49,18 @@
 ##end
 #
 ##variable
+#   CPACK_NSIS_EXTRA_PAGES - Extra NSIS commands specifying additional
+#   setup wizard pages, which will be displayed before the components
+#   page.
+##end
+#
+##variable
+#   CPACK_NSIS_EXTRA_INIT_COMMANDS - Extra NSIS commands that will be
+#   added to the end of the initialization routine and executed before the
+#   GUI is displayed.
+##end
+#
+##variable
 #   CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the
 #   NSIS SetCompressor command.
 ##end
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
index 76310af..cbd8e54 100644
--- a/Modules/NSIS.template.in
+++ b/Modules/NSIS.template.in
@@ -559,6 +559,7 @@ FunctionEnd
   !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
   !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
 
+  @CPACK_NSIS_EXTRA_PAGES@
   @CPACK_NSIS_PAGE_COMPONENTS@
 
   !insertmacro MUI_PAGE_INSTFILES
@@ -974,4 +975,5 @@ inst:
     !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
 
   noOptionsPage:
+  @CPACK_NSIS_EXTRA_INIT_COMMANDS@
 FunctionEnd
-- 
1.8.3.msysgit.0

