... | @@ -11,7 +11,7 @@ project as a single, monolithic unit: either the whole set of files is |
... | @@ -11,7 +11,7 @@ project as a single, monolithic unit: either the whole set of files is |
|
installed, or none of the files are installed. However, with many
|
|
installed, or none of the files are installed. However, with many
|
|
projects it makes sense for the installation to be subdivided into
|
|
projects it makes sense for the installation to be subdivided into
|
|
distinct, user-selectable components: some users may want to install
|
|
distinct, user-selectable components: some users may want to install
|
|
only the comand-line tools for a project, while other users might want
|
|
only the command-line tools for a project, while other users might want
|
|
the GUI or the header files.
|
|
the GUI or the header files.
|
|
|
|
|
|
This document describes how to configure CPack to generate
|
|
This document describes how to configure CPack to generate
|
... | @@ -27,37 +27,37 @@ to *group* things together in order to define component content. |
... | @@ -27,37 +27,37 @@ to *group* things together in order to define component content. |
|
|
|
|
|
There are some basic rules about components:
|
|
There are some basic rules about components:
|
|
|
|
|
|
1. An object cannot belong to several COMPONENT
|
|
1. An object cannot belong to several `COMPONENT`
|
|
2. Each COMPONENT may only belong to a single component GROUP
|
|
2. Each `COMPONENT` may only belong to a single component `GROUP`
|
|
3. Each COMPONENT may be included in several INSTALL_TYPE
|
|
3. Each `COMPONENT` may be included in several `INSTALL_TYPE`
|
|
4. The name of each COMPONENT should be unique (and different from
|
|
4. The name of each `COMPONENT` should be unique (and different from
|
|
*Unspecified* which is a reserved component name)
|
|
*Unspecified* which is a reserved component name)
|
|
5. The name of a component GROUP should be unique and cannot be the
|
|
5. The name of a component `GROUP` should be unique and cannot be the
|
|
same as the name of a COMPONENT
|
|
same as the name of a `COMPONENT`
|
|
6. A component GROUP may have a PARENT_GROUP which is a component
|
|
6. A component `GROUP` may have a `PARENT_GROUP` which is a component
|
|
GROUP
|
|
`GROUP`
|
|
7. A component does not have to belong to any component GROUP
|
|
7. A component does not have to belong to any component `GROUP`
|
|
8. There may be no component GROUP at all (using component grouping is
|
|
8. There may be no component `GROUP` at all (using component grouping is
|
|
**not mandatory**)
|
|
**not mandatory**)
|
|
9. There may be no component at all (using component install is **not
|
|
9. There may be no component at all (using component install is **not
|
|
mandatory**)
|
|
mandatory**)
|
|
10. Not all CPack generators honor component packaging, some of them
|
|
10. Not all CPack generators honor component packaging, some of them
|
|
just **ignore** the component specification
|
|
just **ignore** the component specification
|
|
|
|
|
|
### Specificying components and groups
|
|
### Specifying components and groups
|
|
|
|
|
|
First for each install rule like this one:
|
|
First for each install rule like this one:
|
|
|
|
```cmake
|
|
INSTALL(...
|
|
install(...
|
|
[COMPONENT component]
|
|
[COMPONENT component]
|
|
...)
|
|
...)
|
|
|
|
```
|
|
the COMPONENT option should be specified with the name of the chosen
|
|
the `COMPONENT` option should be specified with the name of the chosen
|
|
component. This means that all objects (TARGETS, FILES, ...) concerned
|
|
component. This means that all objects (`TARGETS`, `FILES`, ...) concerned
|
|
by this install rule will belong to the specified component.
|
|
by this install rule will belong to the specified component.
|
|
|
|
|
|
If some INSTALL rule does not specify the COMPONENT CMake will create a
|
|
If some `INSTALL` rule does not specify the `COMPONENT` CMake will create a
|
|
COMPONENT named *Unspecified* which contains the target of every such
|
|
`COMPONENT` named *Unspecified* which contains the target of every such
|
|
rules.
|
|
rules.
|
|
|
|
|
|
After that grouping and dependencies may be specified by two ways:
|
|
After that grouping and dependencies may be specified by two ways:
|
... | @@ -85,13 +85,14 @@ packaging will produce: |
... | @@ -85,13 +85,14 @@ packaging will produce: |
|
|
|
|
|
The component aware generators may be forced to ignore component if one
|
|
The component aware generators may be forced to ignore component if one
|
|
set:
|
|
set:
|
|
|
|
```cmake
|
|
set(CPACK_MONOLITHIC_INSTALL 1)
|
|
set(CPACK_MONOLITHIC_INSTALL 1)
|
|
|
|
```
|
|
|
|
|
|
If this variable is set at CMake time (inside a CMakeLists.txt) then all
|
|
If this variable is set at CMake time (inside a CMakeLists.txt) then all
|
|
generators will be producing a single a.k.a. MONOLITHIC package file.
|
|
generators will be producing a single a.k.a. MONOLITHIC package file.
|
|
Since CMake/CPack 2.8.4 the CPACK_MONOLITHIC_INSTALL var may be
|
|
Since CMake/CPack 2.8.4 the `CPACK_MONOLITHIC_INSTALL` var may be
|
|
handled at CPack time if set inside CPACK_PROJECT_CONFIG_FILE.
|
|
handled at CPack time if set inside `CPACK_PROJECT_CONFIG_FILE`.
|
|
|
|
|
|
#### Enabling Component Packaging
|
|
#### Enabling Component Packaging
|
|
|
|
|
... | @@ -99,55 +100,56 @@ Some component-aware generators have backward-compatible behavior which |
... | @@ -99,55 +100,56 @@ Some component-aware generators have backward-compatible behavior which |
|
makes them NOT generate a component based install - this is true for
|
|
makes them NOT generate a component based install - this is true for
|
|
RPM, DEB, and any of the archive generators. If you want to change this
|
|
RPM, DEB, and any of the archive generators. If you want to change this
|
|
default non-component-aware behavior you may set the specific variable
|
|
default non-component-aware behavior you may set the specific variable
|
|
CPACK_<GENNAME>_COMPONENT_INSTALL to ON. For example for enabling
|
|
`CPACK_<GENNAME>_COMPONENT_INSTALL` to ON. For example for enabling
|
|
component for the RPM generator you'll have to:
|
|
component for the RPM generator you'll have to:
|
|
|
|
```cmake
|
|
|
|
set(CPACK_RPM_COMPONENT_INSTALL ON)
|
|
|
|
```
|
|
|
|
|
|
set(CPACK_RPM_COMPONENT_INSTALL ON)
|
|
Note that the single variable `CPACK_ARCHIVE_COMPONENT_INSTALL` applies
|
|
|
|
|
|
Note that the single variable CPACK_ARCHIVE_COMPONENT_INSTALL applies
|
|
|
|
to *all* archive generators, including STGZ, TBZ2, TGZ, TZ and ZIP.
|
|
to *all* archive generators, including STGZ, TBZ2, TGZ, TZ and ZIP.
|
|
|
|
|
|
#### Controlling Differents Ways of packaging components
|
|
#### Controlling Different Ways of packaging components
|
|
|
|
|
|
For CPack generators which generates several packages the default
|
|
For CPack generators which generates several packages the default
|
|
behavior is to generate one package per COMPONENT GROUP. However, one
|
|
behavior is to generate one package per `COMPONENT GROUP`. However, one
|
|
can modify this default behavior by using:
|
|
can modify this default behavior by using:
|
|
|
|
|
|
- Single package file containing all COMPONENTS (ignore COMPONENT
|
|
- Single package file containing all COMPONENTS (ignore COMPONENT
|
|
GROUP and single file):
|
|
GROUP and single file):
|
|
|
|
|
|
<!-- end list -->
|
|
<!-- end list -->
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
|
|
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
|
|
|
|
```
|
|
or
|
|
or
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENTS_GROUPING "ALL_COMPONENTS_IN_ONE")
|
|
set(CPACK_COMPONENTS_GROUPING "ALL_COMPONENTS_IN_ONE")
|
|
|
|
```
|
|
- One package per COMPONENT (ignore COMPONENT GROUP but several
|
|
- One package per COMPONENT (ignore COMPONENT GROUP but several
|
|
files):
|
|
files):
|
|
|
|
|
|
<!-- end list -->
|
|
<!-- end list -->
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
|
|
set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
|
|
|
|
```
|
|
or
|
|
or
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENTS_GROUPING "IGNORE")
|
|
set(CPACK_COMPONENTS_GROUPING "IGNORE")
|
|
|
|
```
|
|
|
|
|
|
#### Controlling the package names
|
|
#### Controlling the package names
|
|
|
|
|
|
The name of the package generated by CPack is controlled by several
|
|
The name of the package generated by CPack is controlled by several
|
|
CPACK_xxx variables. And some name mangling rules.
|
|
`CPACK_xxx` variables. And some name mangling rules.
|
|
|
|
|
|
- CPACK_PACKAGE_FILE_NAME which is the name of package file
|
|
- `CPACK_PACKAGE_FILE_NAME` which is the name of package file
|
|
(without extension) if it is not set by the user then CPack set it
|
|
(without extension) if it is not set by the user then CPack set it
|
|
to
|
|
to `"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}"`
|
|
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}"
|
|
|
|
|
|
|
|
<!-- end list -->
|
|
<!-- end list -->
|
|
|
|
|
|
- CPACK_<GEN>_USE_DISPLAY_NAME_IN_FILENAME which may be set to
|
|
- `CPACK_<GEN>_USE_DISPLAY_NAME_IN_FILENAME` which may be set to
|
|
ON or OFF indicates whether if component-aware CPack generators
|
|
ON or OFF indicates whether if component-aware CPack generators
|
|
should mangle the package name after the DISPLAY name of the
|
|
should mangle the package name after the DISPLAY name of the
|
|
component (or component group) or simply use the name of the
|
|
component (or component group) or simply use the name of the
|
... | @@ -175,29 +177,29 @@ only available since CMake 2.6.1 (NSIS and PackageMaker) or CMake 2.8.3 |
... | @@ -175,29 +177,29 @@ only available since CMake 2.6.1 (NSIS and PackageMaker) or CMake 2.8.3 |
|
come sooner or later, check the release notes.
|
|
come sooner or later, check the release notes.
|
|
|
|
|
|
As our primary example, we will use a simple library called "MyLib" that
|
|
As our primary example, we will use a simple library called "MyLib" that
|
|
builds a single library (\`mylib\`) and an application based on that
|
|
builds a single library (mylib) and an application based on that
|
|
library (\`mylibapp\`). The file
|
|
library (mylibapp). The file
|
|
[ComponentExampleStart.zip](/uploads/6db54e1acb1ea4470ac5cefa98524384/ComponentExampleStart.zip)
|
|
[ComponentExampleStart.zip](/uploads/6db54e1acb1ea4470ac5cefa98524384/ComponentExampleStart.zip)
|
|
contains the skeleton of such a
|
|
contains the skeleton of such a
|
|
library, with the following build and installation commands in
|
|
library, with the following build and installation commands in CMakeLists.txt:
|
|
\`CMakeLists.txt\`:
|
|
```cmake
|
|
|
|
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
|
|
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
|
|
project(MyLib)
|
|
project(MyLib)
|
|
|
|
|
|
add_library(mylib mylib.cpp)
|
|
add_library(mylib mylib.cpp)
|
|
|
|
|
|
add_executable(mylibapp mylibapp.cpp)
|
|
add_executable(mylibapp mylibapp.cpp)
|
|
target_link_libraries(mylibapp mylib)
|
|
target_link_libraries(mylibapp mylib)
|
|
|
|
|
|
install(TARGETS mylib
|
|
install(TARGETS mylib
|
|
ARCHIVE
|
|
ARCHIVE
|
|
DESTINATION lib)
|
|
DESTINATION lib)
|
|
install(TARGETS mylibapp
|
|
install(TARGETS mylibapp
|
|
RUNTIME
|
|
RUNTIME
|
|
DESTINATION bin)
|
|
DESTINATION bin)
|
|
install(FILES mylib.h
|
|
install(FILES mylib.h
|
|
DESTINATION include)
|
|
DESTINATION include)
|
|
```
|
|
|
|
|
|
You should be able to configure, build, and (optionally) install this
|
|
You should be able to configure, build, and (optionally) install this
|
|
project using CMake with its library, application, and header file.
|
|
project using CMake with its library, application, and header file.
|
... | @@ -205,31 +207,32 @@ project using CMake with its library, application, and header file. |
... | @@ -205,31 +207,32 @@ project using CMake with its library, application, and header file. |
|
## Building Binary Installers with CPack
|
|
## Building Binary Installers with CPack
|
|
|
|
|
|
To build binary installers with CPack, first add the following to the
|
|
To build binary installers with CPack, first add the following to the
|
|
end of \`CMakeLists.txt\`:
|
|
end of CMakeLists.txt:
|
|
|
|
```cmake
|
|
set(CPACK_PACKAGE_NAME "MyLib")
|
|
set(CPACK_PACKAGE_NAME "MyLib")
|
|
set(CPACK_PACKAGE_VENDOR "CMake.org")
|
|
set(CPACK_PACKAGE_VENDOR "CMake.org")
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example")
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example")
|
|
set(CPACK_PACKAGE_VERSION "1.0.0")
|
|
set(CPACK_PACKAGE_VERSION "1.0.0")
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "1")
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "1")
|
|
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
|
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
|
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
|
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
|
|
|
|
|
|
# This must always be last!
|
|
# This must always be last!
|
|
include(CPack)
|
|
include(CPack)
|
|
|
|
```
|
|
|
|
|
|
More information about CPack and its configuration macros can be found
|
|
More information about CPack and its configuration macros can be found
|
|
[here](doc/cpack/Configuration "wikilink"), but this boilerplate
|
|
[here](doc/cpack/Configuration "wikilink"), but this boilerplate
|
|
suffices to enable the packaging target in a CMake build. From here,
|
|
suffices to enable the packaging target in a CMake build. From here,
|
|
makefile users can invove \`make package\` to build a binary installer
|
|
makefile users can involve `make package` to build a binary installer
|
|
(e.g., on Mac OS X) and Visual Studio users can build the PACKAGE
|
|
(e.g., on Mac OS X) and Visual Studio users can build the PACKAGE
|
|
target.
|
|
target.
|
|
|
|
|
|
Throughout this tutorial, we will be setting more \`CPACK_\` macros in
|
|
Throughout this tutorial, we will be setting more CPack macros in
|
|
\`CMakeLists.txt\` to communicate with CPack. It is very important that
|
|
CMakeLists.txt to communicate with CPack. It is very important that
|
|
the SET commands for these macros come before the include of the
|
|
the SET commands for these macros come before the include of the
|
|
\`CPack\` module\!
|
|
CPack module\!
|
|
|
|
|
|
## Identifying Components
|
|
## Identifying Components
|
|
|
|
|
... | @@ -243,31 +246,33 @@ on the internal structure of your program. |
... | @@ -243,31 +246,33 @@ on the internal structure of your program. |
|
|
|
|
|
For each of these components, we need to identify which installed files
|
|
For each of these components, we need to identify which installed files
|
|
are part of the component. For each INSTALL command in
|
|
are part of the component. For each INSTALL command in
|
|
\`CMakeLists.txt\`, add an appropriate COMPONENT argument stating which
|
|
CMakeLists.txt, add an appropriate COMPONENT argument stating which
|
|
component the installed files will be associated with:
|
|
component the installed files will be associated with:
|
|
|
|
```cmake
|
|
install(TARGETS mylib
|
|
install(TARGETS mylib
|
|
ARCHIVE
|
|
ARCHIVE
|
|
DESTINATION lib
|
|
DESTINATION lib
|
|
COMPONENT libraries)
|
|
COMPONENT libraries)
|
|
install(TARGETS mylibapp
|
|
install(TARGETS mylibapp
|
|
RUNTIME
|
|
RUNTIME
|
|
DESTINATION bin
|
|
DESTINATION bin
|
|
COMPONENT applications)
|
|
COMPONENT applications)
|
|
install(FILES mylib.h
|
|
install(FILES mylib.h
|
|
DESTINATION include
|
|
DESTINATION include
|
|
COMPONENT headers)
|
|
COMPONENT headers)
|
|
|
|
```
|
|
|
|
|
|
Note that the COMPONENT argument to the INSTALL command is not new; it
|
|
Note that the COMPONENT argument to the INSTALL command is not new; it
|
|
has been a part of CMake's INSTALL command to allow installation of only
|
|
has been a part of CMake's INSTALL command to allow installation of only
|
|
part of a project. If you are using any of the older installation
|
|
part of a project. If you are using any of the older installation
|
|
commands (INSTALL_TARGETS, INSTALL_FILES , etc.), you will need to
|
|
commands (`INSTALL_TARGETS`, `INSTALL_FILES` , etc.), you will need to
|
|
convert them to INSTALL commands to add the COMPONENT argument.
|
|
convert them to INSTALL commands to add the COMPONENT argument.
|
|
|
|
|
|
Finally, notify CPack of the names of all of the components in your
|
|
Finally, notify CPack of the names of all of the components in your
|
|
project by setting the CPACK_COMPONENTS_ALL variables:
|
|
project by setting the `CPACK_COMPONENTS_ALL` variables:
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENTS_ALL applications libraries headers)
|
|
set(CPACK_COMPONENTS_ALL applications libraries headers)
|
|
|
|
```
|
|
|
|
|
|
At this point, you can build a component-based installer with CPack that
|
|
At this point, you can build a component-based installer with CPack that
|
|
will allow one to independently install the applications, libraries, and
|
|
will allow one to independently install the applications, libraries, and
|
... | @@ -283,15 +288,16 @@ that the names of the actual components in the installer are not very |
... | @@ -283,15 +288,16 @@ that the names of the actual components in the installer are not very |
|
descriptive: they just say "applications", "libraries", or "headers", as
|
|
descriptive: they just say "applications", "libraries", or "headers", as
|
|
in the component names. We can improve on these names by setting several
|
|
in the component names. We can improve on these names by setting several
|
|
additional CPack variables:
|
|
additional CPack variables:
|
|
|
|
```cmake
|
|
|
|
set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "MyLib Application")
|
|
|
|
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
|
|
|
|
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers")
|
|
|
|
```
|
|
|
|
|
|
set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "MyLib Application")
|
|
Any macro prefixed with `CPACK_COMPONENT_${COMPNAME}`, where `${COMPNAME}`
|
|
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
|
|
|
|
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers")
|
|
|
|
|
|
|
|
Any macro prefixed with CPACK_COMPONENT_${COMPNAME}, where ${COMPNAME}
|
|
|
|
is the uppercase name of a component, is used to set a particular
|
|
is the uppercase name of a component, is used to set a particular
|
|
property of that component in the installer. Here, we set the
|
|
property of that component in the installer. Here, we set the
|
|
DISPLAY_NAME property of each of our components, so that we get
|
|
`DISPLAY_NAME` property of each of our components, so that we get
|
|
human-readable names. These names will be listed in the selection box
|
|
human-readable names. These names will be listed in the selection box
|
|
rather than the internal component names "applications", "libraries",
|
|
rather than the internal component names "applications", "libraries",
|
|
"headers".
|
|
"headers".
|
... | @@ -311,13 +317,14 @@ in a separate "description" box in the installer, and will be updated |
... | @@ -311,13 +317,14 @@ in a separate "description" box in the installer, and will be updated |
|
either when the user's mouse hovers over the name of the corresponding
|
|
either when the user's mouse hovers over the name of the corresponding
|
|
component (Windows) or when the user clicks on a component (Mac OS X).
|
|
component (Windows) or when the user clicks on a component (Mac OS X).
|
|
Here, we add a description for each of our components:
|
|
Here, we add a description for each of our components:
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION
|
|
set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION
|
|
"An extremely useful application that makes use of MyLib")
|
|
"An extremely useful application that makes use of MyLib")
|
|
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
|
|
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
|
|
"Static libraries used to build programs with MyLib")
|
|
"Static libraries used to build programs with MyLib")
|
|
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
|
|
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
|
|
"C/C++ header files for use with MyLib")
|
|
"C/C++ header files for use with MyLib")
|
|
|
|
```
|
|
|
|
|
|
Generally, descriptions should provide enough information for the user
|
|
Generally, descriptions should provide enough information for the user
|
|
to make a decision whether to include the component, but should not
|
|
to make a decision whether to include the component, but should not
|
... | @@ -345,8 +352,9 @@ used if the user also installs the library binary to link her program |
... | @@ -345,8 +352,9 @@ used if the user also installs the library binary to link her program |
|
against. Thus, the "headers" component depends on the availability of
|
|
against. Thus, the "headers" component depends on the availability of
|
|
the "libraries" component. We can express this notion by setting the
|
|
the "libraries" component. We can express this notion by setting the
|
|
DEPENDS property for the HEADERS component as such:
|
|
DEPENDS property for the HEADERS component as such:
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
|
|
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
|
|
|
|
```
|
|
|
|
|
|
The DEPENDS property for a component is actually at list, and as such a
|
|
The DEPENDS property for a component is actually at list, and as such a
|
|
component can depend on several other components. By expressing all of
|
|
component can depend on several other components. By expressing all of
|
... | @@ -370,20 +378,22 @@ We will expand our example by categorizing its three components, |
... | @@ -370,20 +378,22 @@ We will expand our example by categorizing its three components, |
|
"applications", "libraries", and "headers", into "Runtime" and
|
|
"applications", "libraries", and "headers", into "Runtime" and
|
|
"Development" groups. We place a component into a group by setting the
|
|
"Development" groups. We place a component into a group by setting the
|
|
GROUP property of the component to the name of the group as follows:
|
|
GROUP property of the component to the name of the group as follows:
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime")
|
|
set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime")
|
|
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
|
|
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
|
|
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
|
|
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
|
|
|
|
```
|
|
|
|
|
|
Like components, component groups have various properties that can be
|
|
Like components, component groups have various properties that can be
|
|
customized, including the DISPLAY_NAME and DESCRIPTION. To
|
|
customized, including the `DISPLAY_NAME` and `DESCRIPTION`. To
|
|
customization a component group, set the appropriate CPack macro with
|
|
customization a component group, set the appropriate CPack macro with
|
|
the prefix CPACK_COMPONENT_GROUP_${GROUPNAME}, where ${GROUPNAME} is
|
|
the prefix `CPACK_COMPONENT_GROUP_${GROUPNAME}`, where `${GROUPNAME}` is
|
|
the uppercase name of the group to modify. For example, the following
|
|
the uppercase name of the group to modify. For example, the following
|
|
code adds a description to the "Development" group:
|
|
code adds a description to the "Development" group:
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
|
|
set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
|
|
"All of the tools you'll ever need to develop software")
|
|
"All of the tools you'll ever need to develop software")
|
|
|
|
```
|
|
|
|
|
|
Once you have customized the component groups to your liking, rebuild
|
|
Once you have customized the component groups to your liking, rebuild
|
|
the binary installer to see the new organization: the MyLib application
|
|
the binary installer to see the new organization: the MyLib application
|
... | @@ -413,21 +423,23 @@ For our simple example, we will create only two installation types: a |
... | @@ -413,21 +423,23 @@ For our simple example, we will create only two installation types: a |
|
"Developer" installation type, which includes only the libraries and
|
|
"Developer" installation type, which includes only the libraries and
|
|
headers. To do so, we first tell CPack which installation types we're
|
|
headers. To do so, we first tell CPack which installation types we're
|
|
using:
|
|
using:
|
|
|
|
```cmake
|
|
set(CPACK_ALL_INSTALL_TYPES Full Developer)
|
|
set(CPACK_ALL_INSTALL_TYPES Full Developer)
|
|
|
|
```
|
|
|
|
|
|
Like components and component groups, installation types have some
|
|
Like components and component groups, installation types have some
|
|
properties (e.g., DISPLAY_NAME), which can be set via variables with
|
|
properties (e.g., `DISPLAY_NAME`), which can be set via variables with
|
|
prefix CPACK_INSTALL_TYPE_${INSTNAME}, where ${INSTNAME} is the
|
|
prefix `CPACK_INSTALL_TYPE_${INSTNAME}`, where `${INSTNAME}` is the
|
|
uppercase name of the installation type. See the macro reference for
|
|
uppercase name of the installation type. See the macro reference for
|
|
additional information.
|
|
additional information.
|
|
|
|
|
|
Next, we set the INSTALL_TYPES property of each component to state
|
|
Next, we set the `INSTALL_TYPES` property of each component to state
|
|
which installation types will include that component:
|
|
which installation types will include that component:
|
|
|
|
```cmake
|
|
set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full)
|
|
set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full)
|
|
set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
|
|
set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
|
|
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
|
|
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
|
|
|
|
```
|
|
|
|
|
|
Components can be in any number of installation types. If you now
|
|
Components can be in any number of installation types. If you now
|
|
rebuild the Windows installer, the components page will contain a combo
|
|
rebuild the Windows installer, the components page will contain a combo
|
... | @@ -449,27 +461,27 @@ project. |
... | @@ -449,27 +461,27 @@ project. |
|
|
|
|
|
# Macro Reference
|
|
# Macro Reference
|
|
|
|
|
|
In this reference, ${COMPNAME} refers to a component, ${GROUPNAME}
|
|
In this reference, `${COMPNAME}` refers to a component, `${GROUPNAME}`
|
|
refers to a component group, and ${INSTNAME} refers to an installation
|
|
refers to a component group, and `${INSTNAME}` refers to an installation
|
|
type, all of which are
|
|
type, all of which are
|
|
uppercase.
|
|
uppercase.
|
|
|
|
|
|
| Variable Name | Description |
|
|
| Variable Name | Description |
|
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| CPACK_COMPONENTS_ALL | A list containing the names of all components that should be installed. The presence of this macro indicates that CPack should build a component-based installer. Files associated with any components not listed here or any installation commands not associated with any component will not be installed. |
|
|
| `CPACK_COMPONENTS_ALL` | A list containing the names of all components that should be installed. The presence of this macro indicates that CPack should build a component-based installer. Files associated with any components not listed here or any installation commands not associated with any component will not be installed. |
|
|
| CPACK_COMPONENT_${COMPNAME}_DISPLAY_NAME | The displayed name of the component ${COMPNAME}, used in graphical installers to display the component name. This value can be any string. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_DISPLAY_NAME` | The displayed name of the component `${COMPNAME}`, used in graphical installers to display the component name. This value can be any string. |
|
|
| CPACK_COMPONENT_${COMPNAME}_DESCRIPTION | An extended description of the component ${COMPNAME}, used in graphical installers to give the user additional information about the component. Descriptions can span multiple lines using "\\n" as the line separator. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_DESCRIPTION` | An extended description of the component `${COMPNAME}`, used in graphical installers to give the user additional information about the component. Descriptions can span multiple lines using `\n` as the line separator. |
|
|
| CPACK_COMPONENT_${COMPNAME}_HIDDEN | Flag that indicates that this component will be hidden in the graphical installer, and therefore cannot be selected or installed. Only available with NSIS. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_HIDDEN` | Flag that indicates that this component will be hidden in the graphical installer, and therefore cannot be selected or installed. Only available with NSIS. |
|
|
| CPACK_COMPONENT_${COMPNAME}_REQUIRED | Flag that 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. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_REQUIRED` | Flag that 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. |
|
|
| CPACK_COMPONENT_${COMPNAME}_DISABLED | Flag that indicates that this component should be disabled (unselected) by default. The user is free to select this component for installation. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_DISABLED` | Flag that indicates that this component should be disabled (unselected) by default. The user is free to select this component for installation. |
|
|
| CPACK_COMPONENT_${COMPNAME}_DEPENDS | Lists the components on which this component depends. If this component is selected, then each of the components listed must also be selected. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_DEPENDS` | Lists the components on which this component depends. If this component is selected, then each of the components listed must also be selected. |
|
|
| CPACK_COMPONENT_${COMPNAME}_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. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_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. |
|
|
| CPACK_COMPONENT_${COMPNAME}_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. Only available with NSIS. |
|
|
| `CPACK_COMPONENT_${COMPNAME}_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. Only available with NSIS. |
|
|
| CPACK_COMPONENT_GROUP_${GROUPNAME}_DISPLAY_NAME | The displayed name of the component group ${GROUPNAME}, used in graphical installers to display the component group name. This value can be any string. |
|
|
| `CPACK_COMPONENT_GROUP_${GROUPNAME}_DISPLAY_NAME` | The displayed name of the component group `${GROUPNAME}`, used in graphical installers to display the component group name. This value can be any string. |
|
|
| CPACK_COMPONENT_GROUP_${GROUPNAME}_DESCRIPTION | An extended description of the component group ${GROUPNAME}, used in graphical installers to give the user additional information about the components contained within this group. Descriptions can span multiple lines using "\\n" as the line separator. |
|
|
| `CPACK_COMPONENT_GROUP_${GROUPNAME}_DESCRIPTION` | An extended description of the component group `${GROUPNAME}`, used in graphical installers to give the user additional information about the components contained within this group. Descriptions can span multiple lines using `\n` as the line separator. |
|
|
| CPACK_COMPONENT_GROUP_${GROUPNAME}_BOLD_TITLE | Flag indicating whether the group title should be in bold. Only available with NSIS. |
|
|
| `CPACK_COMPONENT_GROUP_${GROUPNAME}_BOLD_TITLE` | Flag indicating whether the group title should be in bold. Only available with NSIS. |
|
|
| CPACK_COMPONENT_GROUP_${GROUPNAME}_EXPANDED | Flag indicating whether the group should start out "expanded", showing its components. Otherwise only the group name itself will be shown until the user clicks on the group. Only available with NSIS. |
|
|
| `CPACK_COMPONENT_GROUP_${GROUPNAME}_EXPANDED` | Flag indicating whether the group should start out "expanded", showing its components. Otherwise only the group name itself will be shown until the user clicks on the group. Only available with NSIS. |
|
|
| CPACK_INSTALL_TYPE_${INSTNAME}_DISPLAY_NAME | The displayed name of the installation type. This value can be any string. |
|
|
| `CPACK_INSTALL_TYPE_${INSTNAME}_DISPLAY_NAME` | The displayed name of the installation type. This value can be any string. |
|
|
|
|
|
|
# Ideas for Future Development
|
|
# Ideas for Future Development
|
|
|
|
|
... | @@ -480,7 +492,7 @@ uppercase. |
... | @@ -480,7 +492,7 @@ uppercase. |
|
installers.
|
|
installers.
|
|
- CPack RPM generator component support: This is true that RPM has
|
|
- CPack RPM generator component support: This is true that RPM has
|
|
coarser granularity, however one may build 1 RPM by component and
|
|
coarser granularity, however one may build 1 RPM by component and
|
|
embbed appropriate dependencies between each generated RPM. For
|
|
embed appropriate dependencies between each generated RPM. For
|
|
building several RPM at once you may either generate a spec file for
|
|
building several RPM at once you may either generate a spec file for
|
|
each component or generate a single spec file which may contain
|
|
each component or generate a single spec file which may contain
|
|
sub-packages
|
|
sub-packages
|
... | | ... | |