diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-05-26 22:53:27 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-05-26 22:53:40 (GMT) |
commit | 445c73d3fadea0dcc0b52f25ead9afbcd926631b (patch) | |
tree | d66d20ce91d286f99c825dfa2c84782b42f1c84c /Help | |
parent | c5657a2fe42a0de7a5724507888f9f6f1afff8ea (diff) | |
parent | 26e36111d326bbf69f437ef1335423ea3b2835e2 (diff) | |
download | CMake-445c73d3fadea0dcc0b52f25ead9afbcd926631b.zip CMake-445c73d3fadea0dcc0b52f25ead9afbcd926631b.tar.gz CMake-445c73d3fadea0dcc0b52f25ead9afbcd926631b.tar.bz2 |
Merge topic 'cpack-install-opts'
26e36111d3 CPack: Implement new variable CPACK_CUSTOM_INSTALL_VARIABLES
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6141
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/release/dev/cpack-install-opts.rst | 6 | ||||
-rw-r--r-- | Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst | 42 |
3 files changed, 49 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 33beba9..0720d49 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -671,6 +671,7 @@ Variables for CPack /variable/CPACK_ABSOLUTE_DESTINATION_FILES /variable/CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY + /variable/CPACK_CUSTOM_INSTALL_VARIABLES /variable/CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION /variable/CPACK_INCLUDE_TOPLEVEL_DIRECTORY /variable/CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS diff --git a/Help/release/dev/cpack-install-opts.rst b/Help/release/dev/cpack-install-opts.rst new file mode 100644 index 0000000..970f9a9 --- /dev/null +++ b/Help/release/dev/cpack-install-opts.rst @@ -0,0 +1,6 @@ +cpack-install-opts +------------------ + +* The new :variable:`CPACK_CUSTOM_INSTALL_VARIABLES` + can be used to set variables in CPack ``cmake_install.cmake`` + invocations. diff --git a/Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst b/Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst new file mode 100644 index 0000000..534e2ad --- /dev/null +++ b/Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst @@ -0,0 +1,42 @@ +CPACK_CUSTOM_INSTALL_VARIABLES +------------------------------ + +CPack variables (set via e.g. ``cpack -D``, ``CPackConfig.cmake`` or +:variable:`CPACK_PROJECT_CONFIG_FILE` scripts) are not directly visible in +installation scripts. Instead, one can pass a list of ``varName=value`` +pairs in the ``CPACK_CUSTOM_INSTALL_VARIABLES`` variable. At install time, +each list item will result in a variable of the specified name (``varName``) +being set to the given ``value``. The ``=`` can be omitted for an empty +``value``. + +``CPACK_CUSTOM_INSTALL_VARIABLES`` allows the packaging installation to be +influenced by the user or driving script at CPack runtime without having to +regenerate the install scripts. + +Example +""""""" + +.. code-block:: cmake + + install(FILES large.txt DESTINATION data) + + install(CODE [[ + if(ENABLE_COMPRESSION) + # "run-compressor" is a fictional tool that produces + # large.txt.xz from large.txt and then removes the input file + execute_process(COMMAND run-compressor $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/large.txt) + endif() + ]]) + +With the above example snippet, :manual:`cpack <cpack(1)>` will by default +run the installation script with ``ENABLE_COMPRESSION`` unset, resulting in +a package containing the uncompressed ``large.txt``. This can be overridden +when invoking :manual:`cpack <cpack(1)>` like so: + +.. code-block:: shell + + cpack -D "CPACK_CUSTOM_INSTALL_VARIABLES=ENABLE_COMPRESSION=TRUE" + +The installation script will then run with ``ENABLE_COMPRESSION`` set to +``TRUE``, resulting in a package containing the compressed ``large.txt.xz`` +instead. |