summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-04-26 19:13:01 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-04-26 19:13:01 (GMT)
commit9e73c8ee3d73201506d0a293046503f9690e0f24 (patch)
tree5eec0248686d28ebc13e0167b458ab7aab0533a6
parent64c9d25f74a049658c5b5551b33721a6a101c281 (diff)
downloadhdf5-9e73c8ee3d73201506d0a293046503f9690e0f24.zip
hdf5-9e73c8ee3d73201506d0a293046503f9690e0f24.tar.gz
hdf5-9e73c8ee3d73201506d0a293046503f9690e0f24.tar.bz2
[svn-r20641] Add CPack overrides for NSIS install paths. Install for products are: HDF Group/Product/Version
Tested: windows , local linux
-rw-r--r--CMakeLists.txt4
-rw-r--r--MANIFEST78
-rw-r--r--config/cmake/CPack.cmake999
-rw-r--r--config/cmake/NSIS.template.in949
4 files changed, 1990 insertions, 40 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1f4a15..4517d9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -886,9 +886,9 @@ ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
# Set the cpack variables
#-----------------------------------------------------------------------------
IF (NOT HDF5_EXTERNALLY_CONFIGURED)
- SET (CPACK_PACKAGE_VENDOR "The HDF Group")
+ SET (CPACK_PACKAGE_VENDOR "HDF Group")
SET (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}")
- SET (CPACK_PACKAGE_INSTALL_DIRECTORY "HDFGroup/${HDF5_PACKAGE_NAME}")
+ SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${HDF5_PACKAGE_NAME}")
SET (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}")
SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}")
SET (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}")
diff --git a/MANIFEST b/MANIFEST
index 7a27033..cb7a781 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -20,8 +20,8 @@
# in column one with a '#'.
#------------------------------------------------------------------------------
-./.autom4te.cfg _DO_NOT_DISTRIBUTE_
-./.h5chkright.ini _DO_NOT_DISTRIBUTE_
+./.autom4te.cfg _DO_NOT_DISTRIBUTE_
+./.h5chkright.ini _DO_NOT_DISTRIBUTE_
./ACKNOWLEDGMENTS
./COPYING
./MANIFEST
@@ -41,21 +41,21 @@
./bin/COPYING
./bin/buildhdf5
-./bin/checkapi _DO_NOT_DISTRIBUTE_
-./bin/checkposix _DO_NOT_DISTRIBUTE_
-./bin/chkconfigure _DO_NOT_DISTRIBUTE_
-./bin/chkcopyright _DO_NOT_DISTRIBUTE_
+./bin/checkapi _DO_NOT_DISTRIBUTE_
+./bin/checkposix _DO_NOT_DISTRIBUTE_
+./bin/chkconfigure _DO_NOT_DISTRIBUTE_
+./bin/chkcopyright _DO_NOT_DISTRIBUTE_
./bin/chkmanifest
./bin/compile
./bin/config.guess
./bin/config.sub
-./bin/debug-ohdr _DO_NOT_DISTRIBUTE_
+./bin/debug-ohdr _DO_NOT_DISTRIBUTE_
./bin/dependencies
./bin/depcomp
./bin/deploy
./bin/distdep
-./bin/errors _DO_NOT_DISTRIBUTE_
-./bin/gcov_script _DO_NOT_DISTRIBUTE_
+./bin/errors _DO_NOT_DISTRIBUTE_
+./bin/gcov_script _DO_NOT_DISTRIBUTE_
./bin/h5vers
./bin/install-sh
./bin/iostats
@@ -69,13 +69,13 @@
./bin/mkdirs
./bin/mkinstalldirs
./bin/newer
-./bin/reconfigure _DO_NOT_DISTRIBUTE_
-./bin/README _DO_NOT_DISTRIBUTE_
+./bin/reconfigure _DO_NOT_DISTRIBUTE_
+./bin/README _DO_NOT_DISTRIBUTE_
./bin/release
-./bin/runtest _DO_NOT_DISTRIBUTE_
+./bin/runtest _DO_NOT_DISTRIBUTE_
./bin/snapshot
-./bin/snapshot_version _DO_NOT_DISTRIBUTE_
-./bin/timekeeper _DO_NOT_DISTRIBUTE_
+./bin/snapshot_version _DO_NOT_DISTRIBUTE_
+./bin/timekeeper _DO_NOT_DISTRIBUTE_
./bin/trace
./bin/yodconfigure
@@ -216,7 +216,7 @@
./fortran/src/Makefile.am
./fortran/src/Makefile.in
./fortran/src/README
-./fortran/src/README_DEVELOPEMENT _DO_NOT_DISTRIBUTE_
+./fortran/src/README_DEVELOPEMENT _DO_NOT_DISTRIBUTE_
./fortran/src/h5fc.in
./fortran/src/hdf5_fortrandll.def
@@ -417,10 +417,10 @@
./release_docs/INSTALL_parallel
./release_docs/RELEASE.txt
-./src/.indent.pro _DO_NOT_DISTRIBUTE_
-./src/hdf5.lnt _DO_NOT_DISTRIBUTE_
-./src/hdf5-win.lnt _DO_NOT_DISTRIBUTE_
-./src/hdf5-lin.lnt _DO_NOT_DISTRIBUTE_
+./src/.indent.pro _DO_NOT_DISTRIBUTE_
+./src/hdf5.lnt _DO_NOT_DISTRIBUTE_
+./src/hdf5-win.lnt _DO_NOT_DISTRIBUTE_
+./src/hdf5-lin.lnt _DO_NOT_DISTRIBUTE_
./src/COPYING
./src/H5.c
./src/H5checksum.c
@@ -457,7 +457,7 @@
./src/H5Bdbg.c
./src/H5Bpkg.h
./src/H5Bprivate.h
-./src/H5Bpublic.h
+./src/H5Bpublic.h
./src/H5B2.c
./src/H5B2cache.c
./src/H5B2dbg.c
@@ -465,7 +465,7 @@
./src/H5B2int.c
./src/H5B2pkg.h
./src/H5B2private.h
-./src/H5B2public.h
+./src/H5B2public.h
./src/H5B2stat.c
./src/H5B2test.c
./src/H5C.c
@@ -619,7 +619,7 @@
./src/H5HFman.c
./src/H5HFpkg.h
./src/H5HFprivate.h
-./src/H5HFpublic.h
+./src/H5HFpublic.h
./src/H5HFsection.c
./src/H5HFspace.c
./src/H5HFstat.c
@@ -855,23 +855,23 @@
./test/gen_bad_compound.c _DO_NOT_DISTRIBUTE_
./test/gen_bogus.c _DO_NOT_DISTRIBUTE_
./test/gen_cross.c _DO_NOT_DISTRIBUTE_
-./test/gen_deflate.c _DO_NOT_DISTRIBUTE_
+./test/gen_deflate.c _DO_NOT_DISTRIBUTE_
./test/gen_filespace.c _DO_NOT_DISTRIBUTE_
-./test/gen_mergemsg.c _DO_NOT_DISTRIBUTE_
-./test/gen_new_array.c _DO_NOT_DISTRIBUTE_
-./test/gen_new_fill.c _DO_NOT_DISTRIBUTE_
-./test/gen_new_group.c _DO_NOT_DISTRIBUTE_
-./test/gen_new_mtime.c _DO_NOT_DISTRIBUTE_
-./test/gen_new_super.c _DO_NOT_DISTRIBUTE_
-./test/gen_noencoder.c _DO_NOT_DISTRIBUTE_
-./test/gen_nullspace.c _DO_NOT_DISTRIBUTE_
-./test/gen_old_array.c _DO_NOT_DISTRIBUTE_
-./test/gen_old_group.c _DO_NOT_DISTRIBUTE_
-./test/gen_old_layout.c _DO_NOT_DISTRIBUTE_
-./test/gen_old_mtime.c _DO_NOT_DISTRIBUTE_
+./test/gen_mergemsg.c _DO_NOT_DISTRIBUTE_
+./test/gen_new_array.c _DO_NOT_DISTRIBUTE_
+./test/gen_new_fill.c _DO_NOT_DISTRIBUTE_
+./test/gen_new_group.c _DO_NOT_DISTRIBUTE_
+./test/gen_new_mtime.c _DO_NOT_DISTRIBUTE_
+./test/gen_new_super.c _DO_NOT_DISTRIBUTE_
+./test/gen_noencoder.c _DO_NOT_DISTRIBUTE_
+./test/gen_nullspace.c _DO_NOT_DISTRIBUTE_
+./test/gen_old_array.c _DO_NOT_DISTRIBUTE_
+./test/gen_old_group.c _DO_NOT_DISTRIBUTE_
+./test/gen_old_layout.c _DO_NOT_DISTRIBUTE_
+./test/gen_old_mtime.c _DO_NOT_DISTRIBUTE_
./test/gen_sizes_lheap.c _DO_NOT_DISTRIBUTE_
-./test/gen_specmetaread.c _DO_NOT_DISTRIBUTE_
-./test/gen_udlinks.c _DO_NOT_DISTRIBUTE_
+./test/gen_specmetaread.c _DO_NOT_DISTRIBUTE_
+./test/gen_udlinks.c _DO_NOT_DISTRIBUTE_
./test/getname.c
./test/gheap.c
./test/group_old.h5
@@ -895,7 +895,7 @@
./test/reserved.c
./test/pool.c
./test/set_extent.c
-./test/space_overflow.c _DO_NOT_DISTRIBUTE_
+./test/space_overflow.c _DO_NOT_DISTRIBUTE_
./test/specmetaread.h5
./test/stab.c
./test/tarray.c
@@ -1999,6 +1999,8 @@
./config/cmake/vfdTest.cmake
./config/cmake/CTestCustom.cmake
./config/cmake/ConfigureChecks.cmake
+./config/cmake/CPack.cmake
+./config/cmake/NSIS.template.in
./CMakeLists.txt
./CTestConfig.cmake
./c++/CMakeLists.txt
diff --git a/config/cmake/CPack.cmake b/config/cmake/CPack.cmake
new file mode 100644
index 0000000..1f19067
--- /dev/null
+++ b/config/cmake/CPack.cmake
@@ -0,0 +1,999 @@
+# - Build binary and source package installers
+#
+# The CPack module generates binary and source installers in a variety
+# of formats using the cpack program. Inclusion of the CPack module
+# adds two new targets to the resulting makefiles, package and
+# package_source, which build the binary and source installers,
+# respectively. The generated binary installers contain everything
+# installed via CMake's INSTALL command (and the deprecated
+# INSTALL_FILES, INSTALL_PROGRAMS, and INSTALL_TARGETS commands).
+#
+# For certain kinds of binary installers (including the graphical
+# installers on Mac OS X and Windows), CPack generates installers that
+# allow users to select individual application components to
+# install. The contents of each of the components are identified by
+# the COMPONENT argument of CMake's INSTALL command. These components
+# can be annotated with user-friendly names and descriptions,
+# inter-component dependencies, etc., and grouped in various ways to
+# customize the resulting installer. See the cpack_add_* commands,
+# described below, for more information about component-specific
+# installations.
+#
+# The CPACK_GENERATOR variable has different meanings in different
+# contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a
+# *list of generators*: when run with no other arguments, CPack
+# will iterate over that list and produce one package for each
+# generator. In a CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR
+# is a *string naming a single generator*. If you need per-cpack-
+# generator logic to control *other* cpack settings, then you need
+# a CPACK_PROJECT_CONFIG_FILE.
+#
+# The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE.
+# See the top level file CMakeCPackOptions.cmake.in for an example.
+#
+# If set, the CPACK_PROJECT_CONFIG_FILE is included automatically
+# on a per-generator basis. It only need contain overrides.
+#
+# Here's how it works:
+# - cpack runs
+# - it includes CPackConfig.cmake
+# - it iterates over the generators listed in that file's
+# CPACK_GENERATOR list variable (unless told to use just a
+# specific one via -G on the command line...)
+#
+# - foreach generator, it then
+# - sets CPACK_GENERATOR to the one currently being iterated
+# - includes the CPACK_PROJECT_CONFIG_FILE
+# - produces the package for that generator
+#
+# This is the key: For each generator listed in CPACK_GENERATOR
+# in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR
+# internally to *the one currently being used* and then include
+# the CPACK_PROJECT_CONFIG_FILE.
+#
+# Before including this CPack module in your CMakeLists.txt file,
+# there are a variety of variables that can be set to customize
+# the resulting installers. The most commonly-used variables are:
+#
+# CPACK_PACKAGE_NAME - The name of the package (or application). If
+# not specified, defaults to the project name.
+#
+# CPACK_PACKAGE_VENDOR - The name of the package vendor (e.g.,
+# "Kitware").
+#
+# CPACK_PACKAGE_VERSION_MAJOR - Package major Version
+#
+# CPACK_PACKAGE_VERSION_MINOR - Package minor Version
+#
+# CPACK_PACKAGE_VERSION_PATCH - Package patch Version
+#
+# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the
+# project. Used, for example, the introduction screen of a
+# CPack-generated Windows installer to describe the project.
+#
+# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the
+# project (only a few words).
+#
+# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate,
+# not including the extension. For example, cmake-2.6.1-Linux-i686.
+#
+# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the
+# target system, e.g., "CMake 2.5".
+#
+# CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per
+# generator after setting CPACK_GENERATOR to the actual generator
+# being used. Allows per-generator setting of CPACK_* variables at
+# cpack time.
+#
+# CPACK_RESOURCE_FILE_LICENSE - License file for the project, which
+# will typically be displayed to the user (often with an explicit
+# "Accept" button, for graphical installers) prior to installation.
+#
+# CPACK_RESOURCE_FILE_README - ReadMe file for the project, which
+# typically describes in some detail
+#
+# CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which
+# welcomes users to this installer. Typically used in the graphical
+# installers on Windows and Mac OS X.
+#
+# CPACK_MONOLITHIC_INSTALL - Disables the component-based
+# installation mechanism, so that all components are always installed.
+#
+# CPACK_GENERATOR - List of CPack generators to use. If not
+# specified, CPack will create a set of options (e.g.,
+# CPACK_BINARY_NSIS) allowing the user to enable/disable individual
+# generators.
+#
+# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file
+# for binary installers that will be generated by the CPack
+# module. Defaults to CPackConfig.cmake.
+#
+# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along
+# with a text label, to be used to create Start Menu shortcuts on
+# Windows. For example, setting this to the list ccmake;CMake will
+# create a shortcut named "CMake" that will execute the installed
+# executable ccmake.
+#
+# CPACK_STRIP_FILES - List of files to be stripped. Starting with
+# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which
+# enables stripping of all files (a list of files evaluates to TRUE
+# in CMake, so this change is compatible).
+#
+# The following CPack variables are specific to source packages, and
+# will not affect binary packages:
+#
+# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package,
+# e.g., cmake-2.6.1
+#
+# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that
+# will be stripped. Starting with CMake 2.6.0
+# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables
+# stripping of all files (a list of files evaluates to TRUE in CMake,
+# so this change is compatible).
+#
+# CPACK_SOURCE_GENERATOR - List of generators used for the source
+# packages. As with CPACK_GENERATOR, if this is not specified then
+# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP)
+# allowing users to select which packages will be generated.
+#
+# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack
+# configuration file for source installers that will be generated by
+# the CPack module. Defaults to CPackSourceConfig.cmake.
+#
+# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree
+# that won't be packaged when building a source package. This is a
+# list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
+#
+# The following variables are specific to the DragNDrop installers
+# built on Mac OS X:
+#
+# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk
+# image. Defaults to CPACK_PACKAGE_FILE_NAME.
+#
+# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO
+# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF
+# bzip2-compressed). Refer to hdiutil(1) for more information on
+# other available formats.
+#
+# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g.
+# can be used to specify the Finder window position/geometry and
+# layout (such as hidden toolbars, placement of the icons etc.).
+# This file has to be generated by the Finder (either manually or
+# through OSA-script) using a normal folder from which the .DS_Store
+# file can then be extracted.
+#
+# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be
+# used as the background for the Finder Window when the disk image
+# is opened. By default no background image is set. The background
+# image is applied after applying the custom .DS_Store file.
+#
+# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to
+# operate on disk image files on Mac OS X. This variable can be used
+# to override the automatically detected command (or specify its
+# location if the auto-detection fails to find it.)
+#
+# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set
+# extended attributes on files and directories on Mac OS X. This
+# variable can be used to override the automatically detected
+# command (or specify its location if the auto-detection fails to
+# find it.)
+#
+# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile
+# resources on Mac OS X. This variable can be used to override the
+# automatically detected command (or specify its location if the
+# auto-detection fails to find it.)
+#
+# Installers built on Mac OS X using the Bundle generator use the
+# aforementioned DragNDrop variables, plus the following Bundle-specific
+# parameters:
+#
+# CPACK_BUNDLE_NAME - The name of the generated bundle. This
+# appears in the OSX finder as the bundle name. Required.
+#
+# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used
+# as the Info.plist for the generated bundle. This assumes that
+# the caller has generated or specified their own Info.plist file.
+# Required.
+#
+# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as
+# the icon for the generated bundle. This is the icon that appears
+# in the OSX finder for the bundle, and in the OSX dock when the
+# bundle is opened. Required.
+#
+# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that
+# will be run whenever an end-user double-clicks the generated bundle
+# in the OSX Finder. Optional.
+#
+# The following variables are specific to the graphical installers built
+# on Windows using the Nullsoft Installation System.
+#
+# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when
+# installing this project.
+#
+# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented
+# to the end user by the NSIS installer is under this root dir. The full
+# directory presented to the end user is:
+# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
+#
+# CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated
+# install program.
+#
+# CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated
+# uninstall program.
+#
+# CPACK_PACKAGE_ICON - A branding image that will be displayed inside
+# the installer.
+#
+# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will
+# be added to the install Section.
+#
+# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will
+# be added to the uninstall Section.
+#
+# CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the
+# NSIS SetCompressor command.
+#
+# CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page
+# will appear in the installer that will allow the user to choose
+# whether the program directory should be added to the system PATH
+# variable.
+#
+# CPACK_NSIS_DISPLAY_NAME - The display name string that appears in
+# the Windows Add/Remove Program control panel
+#
+# CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the
+# installer.
+#
+# CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that
+# contains the installer icon.
+#
+# CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in
+# installing your application.
+#
+# CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more
+# information about your application.
+#
+# CPACK_NSIS_CONTACT - Contact information for questions and comments
+# about the installation process.
+#
+# CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for
+# creating start menu shortcuts.
+#
+# CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to
+# uninstall start menu shortcuts.
+#
+# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links
+# assumes that they are in 'bin' unless this variable is set.
+# For example, you would set this to 'exec' if your executables are
+# in an exec directory.
+#
+# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option
+# to run on the finish page of the NSIS installer.
+#
+# The following variable is specific to installers build on Mac OS X
+# using PackageMaker:
+#
+# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the
+# resulting PackageMaker archive should be compatible
+# with. Different versions of Mac OS X support different
+# features. For example, CPack can only build component-based
+# installers for Mac OS X 10.4 or newer, and can only build
+# installers that download component son-the-fly for Mac OS X 10.5
+# or newer. If left blank, this value will be set to the minimum
+# version of Mac OS X that supports the requested features. Set this
+# variable to some value (e.g., 10.4) only if you want to guarantee
+# that your installer will work on that version of Mac OS X, and
+# don't mind missing extra features available in the installer
+# shipping with later versions of Mac OS X.
+#
+# The following variables are for advanced uses of CPack:
+#
+# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the
+# project is CMake project. Defaults to the value of CMAKE_GENERATOR;
+# few users will want to change this setting.
+#
+# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify
+# what project to install. The four values are: Build directory,
+# Project Name, Project Component, Directory. If omitted, CPack will
+# build an installer that installers everything.
+#
+# CPACK_SYSTEM_NAME - System name, defaults to the value of
+# ${CMAKE_SYSTEM_NAME}.
+#
+# CPACK_PACKAGE_VERSION - Package full version, used internally. By
+# default, this is built from CPACK_PACKAGE_VERSION_MAJOR,
+# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.
+#
+# CPACK_TOPLEVEL_TAG - Directory for the installed files.
+#
+# CPACK_INSTALL_COMMANDS - Extra commands to install components.
+#
+# CPACK_INSTALL_DIRECTORIES - Extra directories to install.
+#
+# Component-specific installation allows users to select specific sets
+# of components to install during the install process. Installation
+# components are identified by the COMPONENT argument of CMake's
+# INSTALL commands, and should be further described by the following
+# CPack commands:
+#
+# cpack_add_component - Describes a CPack installation component
+# named by the COMPONENT argument to a CMake INSTALL command.
+#
+# cpack_add_component(compname
+# [DISPLAY_NAME name]
+# [DESCRIPTION description]
+# [HIDDEN | REQUIRED | DISABLED ]
+# [GROUP group]
+# [DEPENDS comp1 comp2 ... ]
+# [INSTALL_TYPES type1 type2 ... ]
+# [DOWNLOADED]
+# [ARCHIVE_FILE filename])
+#
+# The cmake_add_component command describes an installation
+# component, which the user can opt to install or remove as part of
+# the graphical installation process. compname is the name of the
+# component, as provided to the COMPONENT argument of one or more
+# CMake INSTALL commands.
+#
+# DISPLAY_NAME is the displayed name of the component, used in
+# graphical installers to display the component name. This value can
+# be any string.
+#
+# DESCRIPTION is an extended description of the component, used in
+# graphical installers to give the user additional information about
+# the component. Descriptions can span multiple lines using "\n" as
+# the line separator. Typically, these descriptions should be no
+# more than a few lines long.
+#
+# HIDDEN indicates that this component will be hidden in the
+# graphical installer, so that the user cannot directly change
+# whether it is installed or not.
+#
+# REQUIRED indicates that this component is required, and therefore
+# will always be installed. It will be visible in the graphical
+# installer, but it cannot be unselected. (Typically, required
+# components are shown greyed out).
+#
+# DISABLED indicates that this component should be disabled
+# (unselected) by default. The user is free to select this component
+# for installation, unless it is also HIDDEN.
+#
+# DEPENDS lists the components on which this component depends. If
+# this component is selected, then each of the components listed
+# must also be selected. The dependency information is encoded
+# within the installer itself, so that users cannot install
+# inconsitent sets of components.
+#
+# GROUP names the component group of which this component is a
+# part. If not provided, the component will be a standalone
+# component, not part of any component group. Component groups are
+# described with the cpack_add_component_group command, detailed
+# below.
+#
+# INSTALL_TYPES lists the installation types of which this component
+# is a part. When one of these installations types is selected, this
+# component will automatically be selected. Installation types are
+# described with the cpack_add_install_type command, detailed below.
+#
+# DOWNLOADED indicates that this component should be downloaded
+# on-the-fly by the installer, rather than packaged in with the
+# installer itself. For more information, see the cpack_configure_downloads
+# command.
+#
+# ARCHIVE_FILE provides a name for the archive file created by CPack
+# to be used for downloaded components. If not supplied, CPack will
+# create a file with some name based on CPACK_PACKAGE_FILE_NAME and
+# the name of the component. See cpack_configure_downloads for more
+# information.
+#
+# cpack_add_component_group - Describes a group of related CPack
+# installation components.
+#
+# cpack_add_component_group(groupname
+# [DISPLAY_NAME name]
+# [DESCRIPTION description]
+# [PARENT_GROUP parent]
+# [EXPANDED]
+# [BOLD_TITLE])
+#
+# The cpack_add_component_group describes a group of installation
+# components, which will be placed together within the listing of
+# options. Typically, component groups allow the user to
+# select/deselect all of the components within a single group via a
+# single group-level option. Use component groups to reduce the
+# complexity of installers with many options. groupname is an
+# arbitrary name used to identify the group in the GROUP argument of
+# the cpack_add_component command, which is used to place a
+# component in a group. The name of the group must not conflict with
+# the name of any component.
+#
+# DISPLAY_NAME is the displayed name of the component group, used in
+# graphical installers to display the component group name. This
+# value can be any string.
+#
+# DESCRIPTION is an extended description of the component group,
+# used in graphical installers to give the user additional
+# information about the components within that group. Descriptions
+# can span multiple lines using "\n" as the line
+# separator. Typically, these descriptions should be no more than a
+# few lines long.
+#
+# PARENT_GROUP, if supplied, names the parent group of this group.
+# Parent groups are used to establish a hierarchy of groups,
+# providing an arbitrary hierarchy of groups.
+#
+# EXPANDED indicates that, by default, the group should show up as
+# "expanded", so that the user immediately sees all of the
+# components within the group. Otherwise, the group will initially
+# show up as a single entry.
+#
+# BOLD_TITLE indicates that the group title should appear in bold,
+# to call the user's attention to the group.
+#
+# cpack_add_install_type - Add a new installation type containing a
+# set of predefined component selections to the graphical installer.
+#
+# cpack_add_install_type(typename
+# [DISPLAY_NAME name])
+#
+# The cpack_add_install_type command identifies a set of preselected
+# components that represents a common use case for an
+# application. For example, a "Developer" install type might include
+# an application along with its header and library files, while an
+# "End user" install type might just include the application's
+# executable. Each component identifies itself with one or more
+# install types via the INSTALL_TYPES argument to
+# cpack_add_component.
+#
+# DISPLAY_NAME is the displayed name of the install type, which will
+# typically show up in a drop-down box within a graphical
+# installer. This value can be any string.
+#
+# cpack_configure_downloads - Configure CPack to download selected
+# components on-the-fly as part of the installation process.
+#
+# cpack_configure_downloads(site
+# [UPLOAD_DIRECTORY dirname]
+# [ALL]
+# [ADD_REMOVE|NO_ADD_REMOVE])
+#
+# The cpack_configure_downloads command configures installation-time
+# downloads of selected components. For each downloadable component,
+# CPack will create an archive containing the contents of that
+# component, which should be uploaded to the given site. When the
+# user selects that component for installation, the installer will
+# download and extract the component in place. This feature is
+# useful for creating small installers that only download the
+# requested components, saving bandwidth. Additionally, the
+# installers are small enough that they will be installed as part of
+# the normal installation process, and the "Change" button in
+# Windows Add/Remove Programs control panel will allow one to add or
+# remove parts of the application after the original
+# installation. On Windows, the downloaded-components functionality
+# requires the ZipDLL plug-in for NSIS, available at:
+#
+# http://nsis.sourceforge.net/ZipDLL_plug-in
+#
+# On Mac OS X, installers that download components on-the-fly can
+# only be built and installed on system using Mac OS X 10.5 or
+# later.
+#
+# The site argument is a URL where the archives for downloadable
+# components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/
+# All of the archives produced by CPack should be uploaded to that location.
+#
+# UPLOAD_DIRECTORY is the local directory where CPack will create the
+# various archives for each of the components. The contents of this
+# directory should be uploaded to a location accessible by the URL given
+# in the site argument. If omitted, CPack will use the directory
+# CPackUploads inside the CMake binary directory to store the generated
+# archives.
+#
+# The ALL flag indicates that all components be downloaded. Otherwise, only
+# those components explicitly marked as DOWNLOADED or that have a specified
+# ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies
+# ADD_REMOVE (unless NO_ADD_REMOVE is specified).
+#
+# ADD_REMOVE indicates that CPack should install a copy of the installer
+# that can be called from Windows' Add/Remove Programs dialog (via the
+# "Modify" button) to change the set of installed components. NO_ADD_REMOVE
+# turns off this behavior. This option is ignored on Mac OS X.
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Pick a configuration file
+SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
+IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+ SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
+SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
+IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+ SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
+
+# Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments
+MACRO(cpack_parse_arguments prefix arg_names option_names)
+ SET(${prefix}_DEFAULT_ARGS)
+ FOREACH(arg_name ${arg_names})
+ SET(${prefix}_${arg_name})
+ ENDFOREACH(arg_name)
+ FOREACH(option ${option_names})
+ SET(${prefix}_${option} FALSE)
+ ENDFOREACH(option)
+
+ SET(current_arg_name DEFAULT_ARGS)
+ SET(current_arg_list)
+ FOREACH(arg ${ARGN})
+ SET(larg_names ${arg_names})
+ LIST(FIND larg_names "${arg}" is_arg_name)
+ IF (is_arg_name GREATER -1)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ SET(current_arg_name ${arg})
+ SET(current_arg_list)
+ ELSE (is_arg_name GREATER -1)
+ SET(loption_names ${option_names})
+ LIST(FIND loption_names "${arg}" is_option)
+ IF (is_option GREATER -1)
+ SET(${prefix}_${arg} TRUE)
+ ELSE (is_option GREATER -1)
+ SET(current_arg_list ${current_arg_list} ${arg})
+ ENDIF (is_option GREATER -1)
+ ENDIF (is_arg_name GREATER -1)
+ ENDFOREACH(arg)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(cpack_parse_arguments)
+
+# Macro that appends a SET command for the given variable name (var)
+# to the macro named strvar, but only if the variable named "var"
+# has been defined. The string will eventually be appended to a CPack
+# configuration file.
+MACRO(cpack_append_variable_set_command var strvar)
+ IF (DEFINED ${var})
+ SET(${strvar} "${${strvar}}SET(${var}")
+ FOREACH(APPENDVAL ${${var}})
+ SET(${strvar} "${${strvar}} ${APPENDVAL}")
+ ENDFOREACH(APPENDVAL)
+ SET(${strvar} "${${strvar}})\n")
+ ENDIF (DEFINED ${var})
+ENDMACRO(cpack_append_variable_set_command)
+
+# Macro that appends a SET command for the given variable name (var)
+# to the macro named strvar, but only if the variable named "var"
+# has been defined and is a string. The string will eventually be
+# appended to a CPack configuration file.
+MACRO(cpack_append_string_variable_set_command var strvar)
+ IF (DEFINED ${var})
+ LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
+ IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n")
+ ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ ENDIF (DEFINED ${var})
+ENDMACRO(cpack_append_string_variable_set_command)
+
+# Macro that appends a SET command for the given variable name (var)
+# to the macro named strvar, but only if the variable named "var"
+# has been set to true. The string will eventually be
+# appended to a CPack configuration file.
+MACRO(cpack_append_option_set_command var strvar)
+ IF (${var})
+ LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
+ IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ SET(${strvar} "${${strvar}}SET(${var} TRUE)\n")
+ ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
+ ENDIF (${var})
+ENDMACRO(cpack_append_option_set_command)
+
+# Macro that adds a component to the CPack installer
+MACRO(cpack_add_component compname)
+ STRING(TOUPPER ${compname} CPACK_ADDCOMP_UNAME)
+ cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}
+ "DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE"
+ "HIDDEN;REQUIRED;DISABLED;DOWNLOADED"
+ ${ARGN}
+ )
+
+ if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED)
+ SET(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n")
+ else ()
+ SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n")
+ endif ()
+
+ IF(NOT CPACK_MONOLITHIC_INSTALL)
+ # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the
+ # value of CPACK_COMPONENTS_ALL in the configuration file. This will
+ # take care of any components that have been added after the CPack
+ # moduled was included.
+ IF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
+ GET_CMAKE_PROPERTY(CPACK_ADDCOMP_COMPONENTS COMPONENTS)
+ SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL")
+ FOREACH(COMP ${CPACK_ADDCOMP_COMPONENTS})
+ SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}")
+ ENDFOREACH(COMP)
+ SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n")
+ ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
+ ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
+
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME
+ CPACK_ADDCOMP_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DESCRIPTION
+ CPACK_ADDCOMP_STR)
+ cpack_append_variable_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP
+ CPACK_ADDCOMP_STR)
+ cpack_append_variable_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DEPENDS
+ CPACK_ADDCOMP_STR)
+ cpack_append_variable_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_INSTALL_TYPES
+ CPACK_ADDCOMP_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE
+ CPACK_ADDCOMP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_HIDDEN
+ CPACK_ADDCOMP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED
+ CPACK_ADDCOMP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED
+ CPACK_ADDCOMP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED
+ CPACK_ADDCOMP_STR)
+ FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}")
+ENDMACRO(cpack_add_component)
+
+# Macro that adds a component group to the CPack installer
+MACRO(cpack_add_component_group grpname)
+ STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME)
+ cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}
+ "DISPLAY_NAME;DESCRIPTION"
+ "EXPANDED;BOLD_TITLE"
+ ${ARGN}
+ )
+
+ SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n")
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME
+ CPACK_ADDGRP_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
+ CPACK_ADDGRP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
+ CPACK_ADDGRP_STR)
+ cpack_append_option_set_command(
+ CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_BOLD_TITLE
+ CPACK_ADDGRP_STR)
+ FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}")
+ENDMACRO(cpack_add_component_group)
+
+# Macro that adds an installation type to the CPack installer
+MACRO(cpack_add_install_type insttype)
+ STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME)
+ cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}
+ "DISPLAY_NAME"
+ ""
+ ${ARGN}
+ )
+
+ SET(CPACK_INSTTYPE_STR
+ "\n# Configuration for installation type \"${insttype}\"\n")
+ SET(CPACK_INSTTYPE_STR
+ "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n")
+ cpack_append_string_variable_set_command(
+ CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME
+ CPACK_INSTTYPE_STR)
+ FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}")
+ENDMACRO(cpack_add_install_type)
+
+MACRO(cpack_configure_downloads site)
+ cpack_parse_arguments(CPACK_DOWNLOAD
+ "UPLOAD_DIRECTORY"
+ "ALL;ADD_REMOVE;NO_ADD_REMOVE"
+ ${ARGN}
+ )
+
+ SET(CPACK_CONFIG_DL_STR
+ "\n# Downloaded components configuration\n")
+ SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY})
+ SET(CPACK_DOWNLOAD_SITE ${site})
+ cpack_append_string_variable_set_command(
+ CPACK_DOWNLOAD_SITE
+ CPACK_CONFIG_DL_STR)
+ cpack_append_string_variable_set_command(
+ CPACK_UPLOAD_DIRECTORY
+ CPACK_CONFIG_DL_STR)
+ cpack_append_option_set_command(
+ CPACK_DOWNLOAD_ALL
+ CPACK_CONFIG_DL_STR)
+ IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
+ SET(CPACK_DOWNLOAD_ADD_REMOVE ON)
+ ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
+ SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE})
+ cpack_append_option_set_command(
+ CPACK_ADD_REMOVE
+ CPACK_CONFIG_DL_STR)
+ FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}")
+ENDMACRO(cpack_configure_downloads)
+
+# Macro for setting values if a user did not overwrite them
+MACRO(cpack_set_if_not_set name value)
+ IF(NOT DEFINED "${name}")
+ SET(${name} "${value}")
+ ENDIF(NOT DEFINED "${name}")
+ENDMACRO(cpack_set_if_not_set)
+
+# Macro to encode variables for the configuration file
+# find any varable that stars with CPACK and create a variable
+# _CPACK_OTHER_VARIABLES_ that contains SET commands for
+# each cpack variable. _CPACK_OTHER_VARIABLES_ is then
+# used as an @ replacment in configure_file for the CPackConfig.
+MACRO(cpack_encode_variables)
+ SET(_CPACK_OTHER_VARIABLES_)
+ GET_CMAKE_PROPERTY(res VARIABLES)
+ FOREACH(var ${res})
+ IF("xxx${var}" MATCHES "xxxCPACK")
+ SET(_CPACK_OTHER_VARIABLES_
+ "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
+ ENDIF("xxx${var}" MATCHES "xxxCPACK")
+ ENDFOREACH(var ${res})
+ENDMACRO(cpack_encode_variables)
+
+# Set the package name
+cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
+cpack_set_if_not_set(CPACK_PACKAGE_VERSION
+ "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
+cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
+ "${CMAKE_PROJECT_NAME} built using CMake")
+
+cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
+ "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
+ "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
+ "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
+cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
+ "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
+
+cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
+
+IF(CPACK_NSIS_MODIFY_PATH)
+ SET(CPACK_NSIS_MODIFY_PATH ON)
+ENDIF(CPACK_NSIS_MODIFY_PATH)
+
+SET(__cpack_system_name ${CMAKE_SYSTEM_NAME})
+IF(${__cpack_system_name} MATCHES Windows)
+ IF(CMAKE_CL_64)
+ SET(__cpack_system_name win64)
+ ELSE(CMAKE_CL_64)
+ SET(__cpack_system_name win32)
+ ENDIF(CMAKE_CL_64)
+ENDIF(${__cpack_system_name} MATCHES Windows)
+cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
+
+# Root dir: default value should be the string literal "$PROGRAMFILES"
+# for backwards compatibility. Projects may set this value to anything.
+if(CMAKE_CL_64)
+set(__cpack_root_default "$PROGRAMFILES64")
+else(CMAKE_CL_64)
+set(__cpack_root_default "$PROGRAMFILES")
+endif(CMAKE_CL_64)
+cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
+
+# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
+cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
+ "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
+cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
+ "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
+cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
+ "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
+cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
+cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
+
+# always force to exactly "true" or "false" for CPack.Info.plist.in:
+if(CPACK_PACKAGE_RELOCATABLE)
+ set(CPACK_PACKAGE_RELOCATABLE "true")
+else(CPACK_PACKAGE_RELOCATABLE)
+ set(CPACK_PACKAGE_RELOCATABLE "false")
+endif(CPACK_PACKAGE_RELOCATABLE)
+
+macro(cpack_check_file_exists file description)
+ if(NOT EXISTS "${file}")
+ message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
+ endif(NOT EXISTS "${file}")
+endmacro(cpack_check_file_exists)
+
+cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}" "readme resource")
+cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource")
+
+macro(cpack_optional_append _list _cond _item)
+ if(${_cond})
+ set(${_list} ${${_list}} ${_item})
+ endif(${_cond})
+endmacro(cpack_optional_append _list _cond _item)
+
+# Provide options to choose generators
+# we might check here if the required tools for the generates exist
+# and set the defaults according to the results
+if(NOT CPACK_GENERATOR)
+ if(UNIX)
+ if(CYGWIN)
+ option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
+ else(CYGWIN)
+ if(APPLE)
+ option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF)
+ option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
+ option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON)
+ option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF)
+ else(APPLE)
+ option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
+ endif(APPLE)
+ option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
+ option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
+ option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
+ option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF)
+ option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
+ option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF)
+ endif(CYGWIN)
+ else(UNIX)
+ option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
+ option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
+ endif(UNIX)
+
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_CYGWIN CygwinBinary)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DEB DEB)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
+
+endif(NOT CPACK_GENERATOR)
+
+# Provide options to choose source generators
+if(NOT CPACK_SOURCE_GENERATOR)
+ if(UNIX)
+ if(CYGWIN)
+ option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
+ else(CYGWIN)
+ option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
+ option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON)
+ option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON)
+ option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF)
+ endif(CYGWIN)
+ else(UNIX)
+ option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
+ endif(UNIX)
+
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ)
+ cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP)
+endif(NOT CPACK_SOURCE_GENERATOR)
+
+# mark the above options as advanced
+mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
+ CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2
+ CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
+ CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
+ CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
+ CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
+
+# Set some other variables
+cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
+ "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
+cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
+cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
+# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
+if(DEFINED CPACK_NSIS_DISPLAY_NAME)
+ SET(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
+endif()
+# if the user has set CPACK_NSIS_DISPLAY
+# explicitly, then use that as the default
+# value of CPACK_NSIS_PACKAGE_NAME instead
+# of CPACK_PACKAGE_INSTALL_DIRECTORY
+cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+
+if(CPACK_NSIS_DISPLAY_NAME_SET)
+ string(REPLACE "\\" "\\\\"
+ _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}")
+ cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}")
+else()
+ cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+endif()
+
+cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
+ "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
+
+cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
+ "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
+
+cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
+cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+
+cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
+cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
+
+IF(DEFINED CPACK_COMPONENTS_ALL)
+ IF(CPACK_MONOLITHIC_INSTALL)
+ MESSAGE("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
+ SET(CPACK_COMPONENTS_ALL)
+ ELSE(CPACK_MONOLITHIC_INSTALL)
+ # The user has provided the set of components to be installed as
+ # part of a component-based installation; trust her.
+ SET(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
+ ENDIF(CPACK_MONOLITHIC_INSTALL)
+ELSE(DEFINED CPACK_COMPONENTS_ALL)
+ # If the user has not specifically requested a monolithic installer
+ # but has specified components in various "install" commands, tell
+ # CPack about those components.
+ IF(NOT CPACK_MONOLITHIC_INSTALL)
+ GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS)
+ LIST(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN)
+ IF(CPACK_COMPONENTS_LEN EQUAL 1)
+ # Only one component: this is not a component-based installation
+ # (at least, it isn't a component-based installation, but may
+ # become one later if the user uses the cpack_add_* commands).
+ SET(CPACK_COMPONENTS_ALL)
+ ENDIF(CPACK_COMPONENTS_LEN EQUAL 1)
+ SET(CPACK_COMPONENTS_LEN)
+ ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
+ENDIF(DEFINED CPACK_COMPONENTS_ALL)
+
+# CMake always generates a component named "Unspecified", which is
+# used to install everything that doesn't have an explicitly-provided
+# component. Since these files should always be installed, we'll make
+# them hidden and required.
+set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
+set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
+
+cpack_encode_variables()
+configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
+
+# Generate source file
+cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
+ "${CMAKE_SOURCE_DIR};/")
+cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
+cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
+ "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
+cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
+ "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
+SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
+SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
+SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
+SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
+SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
+SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
+
+cpack_encode_variables()
+configure_file("${cpack_source_input_file}"
+ "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
diff --git a/config/cmake/NSIS.template.in b/config/cmake/NSIS.template.in
new file mode 100644
index 0000000..f28db0f
--- /dev/null
+++ b/config/cmake/NSIS.template.in
@@ -0,0 +1,949 @@
+; CPack install script designed for a nmake build
+
+;--------------------------------
+; You must define these values
+
+ !define VERSION "@CPACK_PACKAGE_VERSION@"
+ !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
+ !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
+
+;--------------------------------
+;Variables
+
+ Var MUI_TEMP
+ Var STARTMENU_FOLDER
+ Var SV_ALLUSERS
+ Var START_MENU
+ Var DO_NOT_ADD_TO_PATH
+ Var ADD_TO_PATH_ALL_USERS
+ Var ADD_TO_PATH_CURRENT_USER
+ Var INSTALL_DESKTOP
+ Var IS_DEFAULT_INSTALLDIR
+;--------------------------------
+;Include Modern UI
+
+ !include "MUI.nsh"
+
+ ;Default installation folder
+ InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+
+;--------------------------------
+;General
+
+ ;Name and file
+ Name "@CPACK_NSIS_PACKAGE_NAME@"
+ OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
+
+ ;Set compression
+ SetCompressor @CPACK_NSIS_COMPRESSOR@
+
+@CPACK_NSIS_DEFINES@
+
+ !include Sections.nsh
+
+;--- Component support macros: ---
+; The code for the add/remove functionality is from:
+; http://nsis.sourceforge.net/Add/Remove_Functionality
+; It has been modified slightly and extended to provide
+; inter-component dependencies.
+Var AR_SecFlags
+Var AR_RegFlags
+@CPACK_NSIS_SECTION_SELECTED_VARS@
+
+; Loads the "selected" flag for the section named SecName into the
+; variable VarName.
+!macro LoadSectionSelectedIntoVar SecName VarName
+ SectionGetFlags ${${SecName}} $${VarName}
+ IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
+!macroend
+
+; Loads the value of a variable... can we get around this?
+!macro LoadVar VarName
+ IntOp $R0 0 + $${VarName}
+!macroend
+
+; Sets the value of a variable
+!macro StoreVar VarName IntValue
+ IntOp $${VarName} 0 + ${IntValue}
+!macroend
+
+!macro InitSection SecName
+ ; This macro reads component installed flag from the registry and
+ ;changes checked state of the section on the components page.
+ ;Input: section index constant name specified in Section command.
+
+ ClearErrors
+ ;Reading component status from registry
+ ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" "Installed"
+ IfErrors "default_${SecName}"
+ ;Status will stay default if registry value not found
+ ;(component was never installed)
+ IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
+ IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
+ IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
+
+ ; Note whether this component was installed before
+ !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
+ IntOp $R0 $AR_RegFlags & $AR_RegFlags
+
+ ;Writing modified flags
+ SectionSetFlags ${${SecName}} $AR_SecFlags
+
+ "default_${SecName}:"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+!macroend
+
+!macro FinishSection SecName
+ ; This macro reads section flag set by user and removes the section
+ ;if it is not selected.
+ ;Then it writes component installed flag to registry
+ ;Input: section index constant name specified in Section command.
+
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
+ ;Checking lowest bit:
+ IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
+ IntCmp $AR_SecFlags 1 "leave_${SecName}"
+ ;Section is not selected:
+ ;Calling Section uninstall macro and writing zero installed flag
+ !insertmacro "Remove_${${SecName}}"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
+ "Installed" 0
+ Goto "exit_${SecName}"
+
+ "leave_${SecName}:"
+ ;Section is selected:
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
+ "Installed" 1
+
+ "exit_${SecName}:"
+!macroend
+
+!macro RemoveSection SecName
+ ; This macro is used to call section's Remove_... macro
+ ;from the uninstaller.
+ ;Input: section index constant name specified in Section command.
+
+ !insertmacro "Remove_${${SecName}}"
+!macroend
+
+; Determine whether the selection of SecName changed
+!macro MaybeSelectionChanged SecName
+ !insertmacro LoadVar ${SecName}_selected
+ SectionGetFlags ${${SecName}} $R1
+ IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
+
+ ; See if the status has changed:
+ IntCmp $R0 $R1 "${SecName}_unchanged"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+
+ IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
+ !insertmacro "Deselect_required_by_${SecName}"
+ goto "${SecName}_unchanged"
+
+ "${SecName}_was_selected:"
+ !insertmacro "Select_${SecName}_depends"
+
+ "${SecName}_unchanged:"
+!macroend
+;--- End of Add/Remove macros ---
+
+;--------------------------------
+;Interface Settings
+
+ !define MUI_HEADERIMAGE
+ !define MUI_ABORTWARNING
+
+;--------------------------------
+; path functions
+
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+;----------------------------------------
+; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
+;----------------------------------------
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+;====================================================
+; get_NT_environment
+; Returns: the selected environment
+; Output : head of the stack
+;====================================================
+!macro select_NT_profile UN
+Function ${UN}select_NT_profile
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
+ DetailPrint "Selected environment for all users"
+ Push "all"
+ Return
+ environment_single:
+ DetailPrint "Selected environment for current user only."
+ Push "current"
+ Return
+FunctionEnd
+!macroend
+!insertmacro select_NT_profile ""
+!insertmacro select_NT_profile "un."
+;----------------------------------------------------
+!define NT_current_env 'HKCU "Environment"'
+!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+
+!ifndef WriteEnvStr_RegKey
+ !ifdef ALL_USERS
+ !define WriteEnvStr_RegKey \
+ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+ !else
+ !define WriteEnvStr_RegKey 'HKCU "Environment"'
+ !endif
+!endif
+
+; AddToPath - Adds the given dir to the search path.
+; Input - head of the stack
+; Note - Win9x systems requires reboot
+
+Function AddToPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+
+ # don't add if the path doesn't exist
+ IfFileExists "$0\*.*" "" AddToPath_done
+
+ ReadEnvStr $1 PATH
+ ; if the path is too long for a NSIS variable NSIS will return a 0
+ ; length string. If we find that, then warn and skip any path
+ ; modification as it will trash the existing path.
+ StrLen $2 $1
+ IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
+ CheckPathLength_ShowPathWarning:
+ Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
+ Goto AddToPath_done
+ CheckPathLength_Done:
+ Push "$1;"
+ Push "$0;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$0\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ GetFullPathName /SHORT $3 $0
+ Push "$1;"
+ Push "$3;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$3\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+
+ Call IsNT
+ Pop $1
+ StrCmp $1 1 AddToPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" a
+ FileSeek $1 -1 END
+ FileReadByte $1 $2
+ IntCmp $2 26 0 +2 +2 # DOS EOF
+ FileSeek $1 -1 END # write over EOF
+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
+ FileClose $1
+ SetRebootFlag true
+ Goto AddToPath_done
+
+ AddToPath_NT:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
+ ReadRegStr $1 ${NT_current_env} "PATH"
+ Goto DoTrim
+ ReadAllKey:
+ ReadRegStr $1 ${NT_all_env} "PATH"
+ DoTrim:
+ StrCmp $1 "" AddToPath_NTdoIt
+ Push $1
+ Call Trim
+ Pop $1
+ StrCpy $0 "$1;$0"
+ AddToPath_NTdoIt:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
+ WriteRegExpandStr ${NT_current_env} "PATH" $0
+ Goto DoSend
+ WriteAllKey:
+ WriteRegExpandStr ${NT_all_env} "PATH" $0
+ DoSend:
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ AddToPath_done:
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+
+; RemoveFromPath - Remove a given dir from the path
+; Input: head of the stack
+
+Function un.RemoveFromPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ IntFmt $6 "%c" 26 # DOS EOF
+
+ Call un.IsNT
+ Pop $1
+ StrCmp $1 1 unRemoveFromPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" r
+ GetTempFileName $4
+ FileOpen $2 $4 w
+ GetFullPathName /SHORT $0 $0
+ StrCpy $0 "SET PATH=%PATH%;$0"
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoop:
+ FileRead $1 $3
+ StrCpy $5 $3 1 -1 # read last char
+ StrCmp $5 $6 0 +2 # if DOS EOF
+ StrCpy $3 $3 -1 # remove DOS EOF so we can compare
+ StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+ FileWrite $2 $3
+ Goto unRemoveFromPath_dosLoop
+ unRemoveFromPath_dosLoopRemoveLine:
+ SetRebootFlag true
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoopEnd:
+ FileClose $2
+ FileClose $1
+ StrCpy $1 $WINDIR 2
+ Delete "$1\autoexec.bat"
+ CopyFiles /SILENT $4 "$1\autoexec.bat"
+ Delete $4
+ Goto unRemoveFromPath_done
+
+ unRemoveFromPath_NT:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
+ ReadRegStr $1 ${NT_current_env} "PATH"
+ Goto unDoTrim
+ unReadAllKey:
+ ReadRegStr $1 ${NT_all_env} "PATH"
+ unDoTrim:
+ StrCpy $5 $1 1 -1 # copy last char
+ StrCmp $5 ";" +2 # if last char != ;
+ StrCpy $1 "$1;" # append ;
+ Push $1
+ Push "$0;"
+ Call un.StrStr ; Find `$0;` in $1
+ Pop $2 ; pos of our dir
+ StrCmp $2 "" unRemoveFromPath_done
+ ; else, it is in path
+ # $0 - path to add
+ # $1 - path var
+ StrLen $3 "$0;"
+ StrLen $4 $2
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+ StrCpy $3 $5$6
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 ";" 0 +2 # if last char == ;
+ StrCpy $3 $3 -1 # remove last char
+
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
+ WriteRegExpandStr ${NT_current_env} "PATH" $3
+ Goto unDoSend
+ unWriteAllKey:
+ WriteRegExpandStr ${NT_all_env} "PATH" $3
+ unDoSend:
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ unRemoveFromPath_done:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Uninstall sutff
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+###########################################
+# Utility Functions #
+###########################################
+
+;====================================================
+; IsNT - Returns 1 if the current system is NT, 0
+; otherwise.
+; Output: head of the stack
+;====================================================
+; IsNT
+; no input
+; output, top of the stack = 1 if NT or 0 if not
+;
+; Usage:
+; Call IsNT
+; Pop $R0
+; ($R0 at this point is 1 or 0)
+
+!macro IsNT un
+Function ${un}IsNT
+ Push $0
+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ StrCmp $0 "" 0 IsNT_yes
+ ; we are not NT.
+ Pop $0
+ Push 0
+ Return
+
+ IsNT_yes:
+ ; NT!!!
+ Pop $0
+ Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+!insertmacro IsNT "un."
+
+; StrStr
+; input, top of stack = string to search for
+; top of stack-1 = string to search in
+; output, top of stack (replaces with the portion of the string remaining)
+; modifies no other variables.
+;
+; Usage:
+; Push "this is a long ass string"
+; Push "ass"
+; Call StrStr
+; Pop $R0
+; ($R0 at this point is "ass string")
+
+!macro StrStr un
+Function ${un}StrStr
+Exch $R1 ; st=haystack,old$R1, $R1=needle
+ Exch ; st=old$R1,haystack
+ Exch $R2 ; st=old$R1,old$R2, $R2=haystack
+ Push $R3
+ Push $R4
+ Push $R5
+ StrLen $R3 $R1
+ StrCpy $R4 0
+ ; $R1=needle
+ ; $R2=haystack
+ ; $R3=len(needle)
+ ; $R4=cnt
+ ; $R5=tmp
+ loop:
+ StrCpy $R5 $R2 $R3 $R4
+ StrCmp $R5 $R1 done
+ StrCmp $R5 "" done
+ IntOp $R4 $R4 + 1
+ Goto loop
+done:
+ StrCpy $R1 $R2 "" $R4
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Exch $R1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
+Function Trim ; Added by Pelaca
+ Exch $R1
+ Push $R2
+Loop:
+ StrCpy $R2 "$R1" 1 -1
+ StrCmp "$R2" " " RTrim
+ StrCmp "$R2" "$\n" RTrim
+ StrCmp "$R2" "$\r" RTrim
+ StrCmp "$R2" ";" RTrim
+ GoTo Done
+RTrim:
+ StrCpy $R1 "$R1" -1
+ Goto Loop
+Done:
+ Pop $R2
+ Exch $R1
+FunctionEnd
+
+Function ConditionalAddToRegisty
+ Pop $0
+ Pop $1
+ StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
+ WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" \
+ "$1" "$0"
+ ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
+ DetailPrint "Set install registry entry: '$1' to '$0'"
+ ConditionalAddToRegisty_EmptyString:
+FunctionEnd
+
+;--------------------------------
+
+!ifdef CPACK_USES_DOWNLOAD
+Function DownloadFile
+ IfFileExists $INSTDIR\* +2
+ CreateDirectory $INSTDIR
+ Pop $0
+
+ ; Skip if already downloaded
+ IfFileExists $INSTDIR\$0 0 +2
+ Return
+
+ StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
+
+ try_again:
+ NSISdl::download "$1/$0" "$INSTDIR\$0"
+
+ Pop $1
+ StrCmp $1 "success" success
+ StrCmp $1 "Cancelled" cancel
+ MessageBox MB_OK "Download failed: $1"
+ cancel:
+ Return
+ success:
+FunctionEnd
+!endif
+
+;--------------------------------
+; Installation types
+@CPACK_NSIS_INSTALLATION_TYPES@
+
+;--------------------------------
+; Component sections
+@CPACK_NSIS_COMPONENT_SECTIONS@
+
+;--------------------------------
+; Define some macro setting for the gui
+@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
+@CPACK_NSIS_INSTALLER_ICON_CODE@
+@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
+@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
+
+;--------------------------------
+;Pages
+ !insertmacro MUI_PAGE_WELCOME
+
+ !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+ Page custom InstallOptionsPage
+ !insertmacro MUI_PAGE_DIRECTORY
+
+ ;Start Menu Folder Page Configuration
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+ !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
+
+ @CPACK_NSIS_PAGE_COMPONENTS@
+
+ !insertmacro MUI_PAGE_INSTFILES
+ !insertmacro MUI_PAGE_FINISH
+
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+
+ !insertmacro MUI_LANGUAGE "English" ;first language is the default language
+ !insertmacro MUI_LANGUAGE "Albanian"
+ !insertmacro MUI_LANGUAGE "Arabic"
+ !insertmacro MUI_LANGUAGE "Basque"
+ !insertmacro MUI_LANGUAGE "Belarusian"
+ !insertmacro MUI_LANGUAGE "Bosnian"
+ !insertmacro MUI_LANGUAGE "Breton"
+ !insertmacro MUI_LANGUAGE "Bulgarian"
+ !insertmacro MUI_LANGUAGE "Croatian"
+ !insertmacro MUI_LANGUAGE "Czech"
+ !insertmacro MUI_LANGUAGE "Danish"
+ !insertmacro MUI_LANGUAGE "Dutch"
+ !insertmacro MUI_LANGUAGE "Estonian"
+ !insertmacro MUI_LANGUAGE "Farsi"
+ !insertmacro MUI_LANGUAGE "Finnish"
+ !insertmacro MUI_LANGUAGE "French"
+ !insertmacro MUI_LANGUAGE "German"
+ !insertmacro MUI_LANGUAGE "Greek"
+ !insertmacro MUI_LANGUAGE "Hebrew"
+ !insertmacro MUI_LANGUAGE "Hungarian"
+ !insertmacro MUI_LANGUAGE "Icelandic"
+ !insertmacro MUI_LANGUAGE "Indonesian"
+ !insertmacro MUI_LANGUAGE "Irish"
+ !insertmacro MUI_LANGUAGE "Italian"
+ !insertmacro MUI_LANGUAGE "Japanese"
+ !insertmacro MUI_LANGUAGE "Korean"
+ !insertmacro MUI_LANGUAGE "Kurdish"
+ !insertmacro MUI_LANGUAGE "Latvian"
+ !insertmacro MUI_LANGUAGE "Lithuanian"
+ !insertmacro MUI_LANGUAGE "Luxembourgish"
+ !insertmacro MUI_LANGUAGE "Macedonian"
+ !insertmacro MUI_LANGUAGE "Malay"
+ !insertmacro MUI_LANGUAGE "Mongolian"
+ !insertmacro MUI_LANGUAGE "Norwegian"
+ !insertmacro MUI_LANGUAGE "Polish"
+ !insertmacro MUI_LANGUAGE "Portuguese"
+ !insertmacro MUI_LANGUAGE "PortugueseBR"
+ !insertmacro MUI_LANGUAGE "Romanian"
+ !insertmacro MUI_LANGUAGE "Russian"
+ !insertmacro MUI_LANGUAGE "Serbian"
+ !insertmacro MUI_LANGUAGE "SerbianLatin"
+ !insertmacro MUI_LANGUAGE "SimpChinese"
+ !insertmacro MUI_LANGUAGE "Slovak"
+ !insertmacro MUI_LANGUAGE "Slovenian"
+ !insertmacro MUI_LANGUAGE "Spanish"
+ !insertmacro MUI_LANGUAGE "Swedish"
+ !insertmacro MUI_LANGUAGE "Thai"
+ !insertmacro MUI_LANGUAGE "TradChinese"
+ !insertmacro MUI_LANGUAGE "Turkish"
+ !insertmacro MUI_LANGUAGE "Ukrainian"
+ !insertmacro MUI_LANGUAGE "Welsh"
+
+
+;--------------------------------
+;Reserve Files
+
+ ;These files should be inserted before other files in the data block
+ ;Keep these lines before any File command
+ ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
+
+ ReserveFile "NSIS.InstallOptions.ini"
+ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
+;--------------------------------
+;Installer Sections
+
+Section "-Core installation"
+ ;Use the entire tree produced by the INSTALL target. Keep the
+ ;list of directories here in sync with the RMDir commands below.
+ SetOutPath "$INSTDIR"
+ @CPACK_NSIS_FULL_INSTALL@
+
+ ;Store installation folder
+ WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
+
+ ;Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+ Push "DisplayName"
+ Push "@CPACK_NSIS_DISPLAY_NAME@"
+ Call ConditionalAddToRegisty
+ Push "DisplayVersion"
+ Push "@CPACK_PACKAGE_VERSION@"
+ Call ConditionalAddToRegisty
+ Push "Publisher"
+ Push "@CPACK_PACKAGE_VENDOR@"
+ Call ConditionalAddToRegisty
+ Push "UninstallString"
+ Push "$INSTDIR\Uninstall.exe"
+ Call ConditionalAddToRegisty
+ Push "NoRepair"
+ Push "1"
+ Call ConditionalAddToRegisty
+
+ !ifdef CPACK_NSIS_ADD_REMOVE
+ ;Create add/remove functionality
+ Push "ModifyPath"
+ Push "$INSTDIR\AddRemove.exe"
+ Call ConditionalAddToRegisty
+ !else
+ Push "NoModify"
+ Push "1"
+ Call ConditionalAddToRegisty
+ !endif
+
+ ; Optional registration
+ Push "DisplayIcon"
+ Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
+ Call ConditionalAddToRegisty
+ Push "HelpLink"
+ Push "@CPACK_NSIS_HELP_LINK@"
+ Call ConditionalAddToRegisty
+ Push "URLInfoAbout"
+ Push "@CPACK_NSIS_URL_INFO_ABOUT@"
+ Call ConditionalAddToRegisty
+ Push "Contact"
+ Push "@CPACK_NSIS_CONTACT@"
+ Call ConditionalAddToRegisty
+ !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+
+ ;Create shortcuts
+ CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+@CPACK_NSIS_CREATE_ICONS@
+@CPACK_NSIS_CREATE_ICONS_EXTRA@
+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
+
+ ;Read a value from an InstallOptions INI file
+ !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
+
+ ; Write special uninstall registry entries
+ Push "StartMenu"
+ Push "$STARTMENU_FOLDER"
+ Call ConditionalAddToRegisty
+ Push "DoNotAddToPath"
+ Push "$DO_NOT_ADD_TO_PATH"
+ Call ConditionalAddToRegisty
+ Push "AddToPathAllUsers"
+ Push "$ADD_TO_PATH_ALL_USERS"
+ Call ConditionalAddToRegisty
+ Push "AddToPathCurrentUser"
+ Push "$ADD_TO_PATH_CURRENT_USER"
+ Call ConditionalAddToRegisty
+ Push "InstallToDesktop"
+ Push "$INSTALL_DESKTOP"
+ Call ConditionalAddToRegisty
+
+ !insertmacro MUI_STARTMENU_WRITE_END
+
+@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
+
+SectionEnd
+
+Section "-Add to path"
+ Push $INSTDIR\bin
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
+ StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
+ Call AddToPath
+ doNotAddToPath:
+SectionEnd
+
+;--------------------------------
+; Create custom pages
+Function InstallOptionsPage
+ !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
+ !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
+
+FunctionEnd
+
+;--------------------------------
+; determine admin versus local install
+Function un.onInit
+
+ ClearErrors
+ UserInfo::GetName
+ IfErrors noLM
+ Pop $0
+ UserInfo::GetAccountType
+ Pop $1
+ StrCmp $1 "Admin" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
+ Goto done
+ StrCmp $1 "Power" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+ Goto done
+
+ noLM:
+ ;Get installation folder from registry if available
+
+ done:
+
+FunctionEnd
+
+;--- Add/Remove callback functions: ---
+!macro SectionList MacroName
+ ;This macro used to perform operation on multiple sections.
+ ;List all of your components in following manner here.
+@CPACK_NSIS_COMPONENT_SECTION_LIST@
+!macroend
+
+Section -FinishComponents
+ ;Removes unselected components and writes component status to registry
+ !insertmacro SectionList "FinishSection"
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+ ; Get the name of the installer executable
+ System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
+ StrCpy $R3 $R0
+
+ ; Strip off the last 13 characters, to see if we have AddRemove.exe
+ StrLen $R1 $R0
+ IntOp $R1 $R0 - 13
+ StrCpy $R2 $R0 13 $R1
+ StrCmp $R2 "AddRemove.exe" addremove_installed
+
+ ; We're not running AddRemove.exe, so install it
+ CopyFiles $R3 $INSTDIR\AddRemove.exe
+
+ addremove_installed:
+!endif
+SectionEnd
+;--- End of Add/Remove callback functions ---
+
+;--------------------------------
+; Component dependencies
+Function .onSelChange
+ !insertmacro SectionList MaybeSelectionChanged
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+ ReadRegStr $START_MENU SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "StartMenu"
+ ;MessageBox MB_OK "Start menu is in: $START_MENU"
+ ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "DoNotAddToPath"
+ ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathAllUsers"
+ ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathCurrentUser"
+ ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
+ ReadRegStr $INSTALL_DESKTOP SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "InstallToDesktop"
+ ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
+
+@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
+
+ ;Remove files we installed.
+ ;Keep the list of directories here in sync with the File commands above.
+@CPACK_NSIS_DELETE_FILES@
+@CPACK_NSIS_DELETE_DIRECTORIES@
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+ ;Remove the add/remove program
+ Delete "$INSTDIR\AddRemove.exe"
+!endif
+
+ ;Remove the uninstaller itself.
+ Delete "$INSTDIR\Uninstall.exe"
+ DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@"
+
+ ;Remove the installation directory if it is empty.
+ RMDir "$INSTDIR"
+
+ ; Remove the registry entries.
+ DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ ; Removes all optional components
+ !insertmacro SectionList "RemoveSection"
+
+ !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
+
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+@CPACK_NSIS_DELETE_ICONS@
+@CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+ ;Delete empty start menu parent diretories
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+ startMenuDeleteLoop:
+ ClearErrors
+ RMDir $MUI_TEMP
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+ IfErrors startMenuDeleteLoopDone
+
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
+ startMenuDeleteLoopDone:
+
+ ; If the user changed the shortcut, then untinstall may not work. This should
+ ; try to fix it.
+ StrCpy $MUI_TEMP "$START_MENU"
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+@CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+ ;Delete empty start menu parent diretories
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+ secondStartMenuDeleteLoop:
+ ClearErrors
+ RMDir $MUI_TEMP
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+ IfErrors secondStartMenuDeleteLoopDone
+
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
+ secondStartMenuDeleteLoopDone:
+
+ DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ Push $INSTDIR\bin
+ StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
+ Call un.RemoveFromPath
+ doNotRemoveFromPath:
+SectionEnd
+
+;--------------------------------
+; determine admin versus local install
+; Is install for "AllUsers" or "JustMe"?
+; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
+; This function is used for the very first "custom page" of the installer.
+; This custom page does not show up visibly, but it executes prior to the
+; first visible page and sets up $INSTDIR properly...
+; Choose different default installation folder based on SV_ALLUSERS...
+; "Program Files" for AllUsers, "My Documents" for JustMe...
+
+Function .onInit
+ ; Reads components status for registry
+ !insertmacro SectionList "InitSection"
+
+ ; check to see if /D has been used to change
+ ; the install directory by comparing it to the
+ ; install directory that is expected to be the
+ ; default
+ StrCpy $IS_DEFAULT_INSTALLDIR 0
+ StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@" 0 +2
+ StrCpy $IS_DEFAULT_INSTALLDIR 1
+
+ StrCpy $SV_ALLUSERS "JustMe"
+ ; if default install dir then change the default
+ ; if it is installed for JustMe
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+
+ ClearErrors
+ UserInfo::GetName
+ IfErrors noLM
+ Pop $0
+ UserInfo::GetAccountType
+ Pop $1
+ StrCmp $1 "Admin" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+ StrCmp $1 "Power" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+
+ noLM:
+ StrCpy $SV_ALLUSERS "AllUsers"
+ ;Get installation folder from registry if available
+
+ done:
+ StrCmp $SV_ALLUSERS "AllUsers" 0 +3
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_DIRECTORY@\@CPACK_PACKAGE_VERSION@"
+
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
+ !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
+
+ noOptionsPage:
+FunctionEnd