Now look at the corresponding CMake code that is needed to have the uninstaller delete that Start Menu shortcut for us:. Internally, CMake configures the installer to save the Start Menu folder selected by the user as a Windows registry item. The uninstaller reads that value back from the registry, but puts it in a differently named variable to the installer. A bit of quick googling will reveal that this is not common knowledge and it is certainly not documented behaviour. Add a comment.
Active Oldest Votes. Improve this answer. Srv19 Srv19 3, 4 4 gold badges 41 41 silver badges 70 70 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Note that the path has forward slashes except for the last part which has an escaped as the path separator.
If you do not do this, you may get the following error:. In addition to creating the two configuration files, CPack. The options added depend on the environment and OS that CMake is running on, and control the default packages that are created by CPack. Turning these options on or off affects the packages that are created when running CPack with no options.
If the option is off in the CMakeCache. Source packages in CPack simply copy the entire source tree for a project into a package file, and no install rules are used as they are in the case of binary packages. Out of source builds should be used to avoid having extra binary stuff polluting the source package. This variable contains a list of regular expressions.
Any file or directory that matches a regular expression in that list will be excluded from the sources. The default setting is as follows:. There are many levels of escapes used in the default value as this variable is parsed by CMake once and CPack again.
It is important to realize that the source tree will not use any install commands, it will simply copy the entire source tree minus the files it is told to ignore into the package. The expression is a regular expression and not a wild card statement, see Chapter 4 for more information about CMake regular expressions.
Since binary packages require CPack to interact with the install rules of the project being packaged, this section will cover some of the options CPack provides to interact with the install rules of a project. In most CMake projects, using the CMake install rules will be sufficient to create the desired package.
By default CPack will run the install rule for the current project. This variable should hold quadruplets of install directory, install project name, install component, and install subdirectory.
For example, if you had a project with a sub project called MySub that was compiled into a directory called SubProject, and you wanted to install all of its components, you would have this:. This allows absolute paths to be installed under the temporary directory. When doing a non- DESTDIR install for packaging, which is the default, any absolute paths are installed into absolute directories, and not into the package.
It is possible to run other install rules if the project is not CMake based. The files in each directory will be copied to the corresponding subdirectory of the CPack staging directory and packaged with the rest of the files. Both files are found in the CMake Modules directory. The install options file contains the information about the pages used in the install wizard. For each part of the installer that can be changed or controlled from CPack, the variables and values used are given.
The first thing that a user will see of the installer in Windows is the icon for the installer executable itself. By default the installer will have the Null Soft Installer icon, as seen in Figure 1 for the CMake installer. The installer for in the same figure shows the CMake icon being used for the installer. The last thing a users will see of the installer in Windows is the icon for the uninstall executable, as seen in Figure 2. Both the install and uninstall icons must be the same size and format, a valid windows.
The icons are set like this:. On Windows, programs can also be removed using the Add or Remove Programs tool from the control panel as seen in Figure 3. The icon for this should be embedded in one of the installed executables. This can be set like this:. When running the installer, the first screen of the wizard will look like Figure 4. In this screen you can control the name of the project that shows up in two places on the screen. The second page of the install wizard can be seen in Figure 5.
This screen contains the license agreement and there are several things that can be configured on this page. CMake does the following:. The third page of the installer can be seen in Figure 6. For example, to create a desktop icon for the cmake-gui program of CMake, the following is done:. Multiple desktop links can be created if your application contains more than one executable. The following CMake code was used to set that default:.
The remaining pages of the installer wizard do not use any additional CPack variables, and are not included in this section. There are several CPack variables that control the default key used.
The key is defined in the NSIS. The variables contain lists of pairs, and must have an even number of elements to work correctly. CMake does the following to create that shortcut:. This variable contains arbitrary links into the install tree, or to external web pages. The first of the pair is always the existing source file or location, and the second is the name that will show up in the Start menu. To add a link to the help file for cmake-gui and a link to the CMake web page add the following:.
In addition to the variables already discussed, CPack provides a few additional variables that are directly configured into the NSIS script file.
They are as follows:. One example of a useful thing that can be done with the extra install commands is to create associations from file extensions to the installed application. For example, if you had an application CoolStuff that could open files with the extension. Extra NSIS commands that will be added to the uninstall Section, before your install tree is removed from the target system.
Ask about uninstalling previous versions first. If this is set to ON , then an installer will look for previous installed versions and if one is found, ask the user whether to uninstall it before proceeding with the install.
Modify PATH toggle. 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.
For example, you would set this to exec if your executables are in an exec directory.
0コメント