CPack.cmake 36.9 KB
Newer Older
1
2
3
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

4
5
6
7
#[=======================================================================[.rst:
CPack
-----

8
Configure generators for binary installers and source packages.
9

10
11
Introduction
^^^^^^^^^^^^
12

13
14
15
16
The CPack module generates the configuration files ``CPackConfig.cmake``
and ``CPackSourceConfig.cmake``. They are intended for use in a subsequent
run of  the :manual:`cpack <cpack(1)>` program where they steer the generation
of installers or/and source packages.
17

18
Depending on the CMake generator, the CPack module may also add two new build
19
20
targets, ``package`` and ``package_source``. See the `packaging targets`_
section below for details.
21

22
23
24
The generated binary installers will contain all files that have been installed
via CMake's :command:`install` command (and the deprecated commands
:command:`install_files`, :command:`install_programs`, and
25
26
27
28
29
30
31
:command:`install_targets`). Note that the ``DESTINATION`` option of the
:command:`install` command must be a relative path; otherwise installed files
are ignored by CPack.

Certain kinds of binary installers can be configured such that users can select
individual application components to install.  See the :module:`CPackComponent`
module for further details.
32
33
34
35
36

Source packages (configured through ``CPackSourceConfig.cmake`` and generated
by the :cpack_gen:`CPack Archive Generator`) will contain all source files in
the project directory except those specified in
:variable:`CPACK_SOURCE_IGNORE_FILES`.
37

38
CPack Generators
39
40
^^^^^^^^^^^^^^^^

41
42
43
44
45
46
47
48
49
50
The :variable:`CPACK_GENERATOR` variable has different meanings in different
contexts.  In a ``CMakeLists.txt`` file, :variable:`CPACK_GENERATOR` is a
*list of generators*: and when :manual:`cpack <cpack(1)>` is run with no other
arguments, it will iterate over that list and produce one package for each
generator.  In a :variable:`CPACK_PROJECT_CONFIG_FILE`,
:variable:`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 :variable:`CPACK_PROJECT_CONFIG_FILE`.
If set, the :variable:`CPACK_PROJECT_CONFIG_FILE` is included automatically
on a per-generator basis.  It only need contain overrides.
51
52
53

Here's how it works:

54
55
* :manual:`cpack <cpack(1)>` runs
* it includes ``CPackConfig.cmake``
56
57
58
* it iterates over the generators given by the :option:`-G <cpack -G>` command
  line option, or if no such option was specified, over the list of generators
  given by the :variable:`CPACK_GENERATOR` variable set in the ``CPackConfig.cmake``
59
  input file.
60
61
* foreach generator, it then

62
63
  - sets :variable:`CPACK_GENERATOR` to the one currently being iterated
  - includes the :variable:`CPACK_PROJECT_CONFIG_FILE`
64
65
  - produces the package for that generator

66
67
68
69
This is the key: For each generator listed in :variable:`CPACK_GENERATOR` in
``CPackConfig.cmake``, cpack will *reset* :variable:`CPACK_GENERATOR`
internally to *the one currently being used* and then include the
:variable:`CPACK_PROJECT_CONFIG_FILE`.
70

71
72
For a list of available generators, see :manual:`cpack-generators(7)`.

73
.. _`packaging targets`:
74
75
76
77
78
79
80
81
82
83
84
85

Targets package and package_source
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If CMake is run with the Makefile, Ninja, or Xcode generator, then
``include(CPack)`` generates a target ``package``. This makes it possible
to build a binary installer from CMake, Make, or Ninja: Instead of ``cpack``,
one may call ``cmake --build . --target package`` or ``make package`` or
``ninja package``. The VS generator creates an uppercase target ``PACKAGE``.

If CMake is run with the Makefile or Ninja generator, then ``include(CPack)``
also generates a target ``package_source``. To build a source package,
86
instead of ``cpack -G TGZ --config CPackSourceConfig.cmake`` one may call
87
88
89
90
``cmake --build . --target package_source``, ``make package_source``,
or ``ninja package_source``.


91
Variables common to all CPack Generators
92
93
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

94
Before including this CPack module in your ``CMakeLists.txt`` file, there
95
96
97
98
99
are a variety of variables that can be set to customize the resulting
installers.  The most commonly-used variables are:

.. variable:: CPACK_PACKAGE_NAME

100
101
  The name of the package (or application).  If not specified, it defaults to
  the project name.
102
103
104

.. variable:: CPACK_PACKAGE_VENDOR

105
  The name of the package vendor. (e.g., "Kitware").  The default is "Humanity".
106
107
108

.. variable:: CPACK_PACKAGE_DIRECTORY

109
110
111
112
113
  The directory in which CPack is doing its packaging.  If it is not set
  then this will default (internally) to the build dir.  This variable may
  be defined in a CPack config file or from the :manual:`cpack <cpack(1)>`
  command line option ``-B``.  If set, the command line option overrides the
  value found in the config file.
114
115
116

.. variable:: CPACK_PACKAGE_VERSION_MAJOR

117
118
119
120
121
122
123
  Package major version.  This variable will always be set, but its default
  value depends on whether or not version details were given to the
  :command:`project` command in the top level CMakeLists.txt file.  If version
  details were given, the default value will be
  :variable:`CMAKE_PROJECT_VERSION_MAJOR`.  If no version details were given,
  a default version of 0.1.1 will be assumed, leading to
  ``CPACK_PACKAGE_VERSION_MAJOR`` having a default value of 0.
124
125
126

.. variable:: CPACK_PACKAGE_VERSION_MINOR

127
128
129
130
131
132
133
134
  Package minor version.  The default value is determined based on whether or
  not version details were given to the :command:`project` command in the top
  level CMakeLists.txt file.  If version details were given, the default
  value will be :variable:`CMAKE_PROJECT_VERSION_MINOR`, but if no minor
  version component was specified then ``CPACK_PACKAGE_VERSION_MINOR`` will be
  left unset.  If no project version was given at all, a default version of
  0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_MINOR`` having a
  default value of 1.
135
136
137

.. variable:: CPACK_PACKAGE_VERSION_PATCH

138
139
140
141
142
143
144
145
  Package patch version.  The default value is determined based on whether or
  not version details were given to the :command:`project` command in the top
  level CMakeLists.txt file.  If version details were given, the default
  value will be :variable:`CMAKE_PROJECT_VERSION_PATCH`, but if no patch
  version component was specified then ``CPACK_PACKAGE_VERSION_PATCH`` will be
  left unset.  If no project version was given at all, a default version of
  0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_PATCH`` having a
  default value of 1.
146

147
148
149
150
151
.. variable:: CPACK_PACKAGE_DESCRIPTION

  A description of the project, used in places such as the introduction
  screen of CPack-generated Windows installers.  If not set, the value of
  this variable is populated from the file named by
152
  :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`.
153

154
155
.. variable:: CPACK_PACKAGE_DESCRIPTION_FILE

156
  A text file used to describe the project when
157
  :variable:`CPACK_PACKAGE_DESCRIPTION` is not explicitly set.  The default
158
159
  value for ``CPACK_PACKAGE_DESCRIPTION_FILE`` points to a built-in template
  file ``Templates/CPack.GenericDescription.txt``.
160
161
162

.. variable:: CPACK_PACKAGE_DESCRIPTION_SUMMARY

163
164
165
166
  Short description of the project (only a few words).  If the
  :variable:`CMAKE_PROJECT_DESCRIPTION` variable is set, it is used as the
  default value, otherwise the default will be a string generated by CMake
  based on :variable:`CMAKE_PROJECT_NAME`.
167
168
169

.. variable:: CPACK_PACKAGE_HOMEPAGE_URL

170
171
172
173
  Project homepage URL.  The default value is taken from the
  :variable:`CMAKE_PROJECT_HOMEPAGE_URL` variable, which is set by the top
  level :command:`project` command, or else the default will be empty if no
  URL was provided to :command:`project`.
174
175
176

.. variable:: CPACK_PACKAGE_FILE_NAME

177
178
179
  The name of the package file to generate, not including the
  extension.  For example, ``cmake-2.6.1-Linux-i686``.  The default value
  is::
180

181
    ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}
182
183
184

.. variable:: CPACK_PACKAGE_INSTALL_DIRECTORY

185
186
187
188
  Installation directory on the target system. This may be used by some
  CPack generators like NSIS to create an installation directory e.g.,
  "CMake 2.5" below the installation prefix.  All installed elements will be
  put inside this directory.
189
190
191

.. variable:: CPACK_PACKAGE_ICON

192
193
  A branding image that will be displayed inside the installer (used by GUI
  installers).
194
195
196

.. variable:: CPACK_PACKAGE_CHECKSUM

197
198
  .. versionadded:: 3.7

199
200
  An algorithm that will be used to generate an additional file with the
  checksum of the package.  The output file name will be::
201
202
203

    ${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM}

204
205
  Supported algorithms are those listed by the
  :ref:`string(\<HASH\>) <Supported Hash Algorithms>` command.
206
207
208

.. variable:: CPACK_PROJECT_CONFIG_FILE

209
210
211
212
  CPack-time project CPack configuration file.  This file is included at cpack
  time, once per generator after CPack has set :variable:`CPACK_GENERATOR`
  to the actual generator being used.  It allows per-generator setting of
  ``CPACK_*`` variables at cpack time.
213
214
215

.. variable:: CPACK_RESOURCE_FILE_LICENSE

216
217
218
219
220
221
222
  License to be embedded in the installer.  It will typically be displayed
  to the user by the produced installer (often with an explicit "Accept"
  button, for graphical installers) prior to installation.  This license
  file is NOT added to the installed files but is used by some CPack generators
  like NSIS.  If you want to install a license file (may be the same as this
  one) along with your project, you must add an appropriate CMake
  :command:`install` command in your ``CMakeLists.txt``.
223
224
225

.. variable:: CPACK_RESOURCE_FILE_README

226
227
228
  ReadMe file to be embedded in the installer.  It typically describes in
  some detail the purpose of the project during the installation.  Not all
  CPack generators use this file.
229
230
231

.. variable:: CPACK_RESOURCE_FILE_WELCOME

232
233
234
  Welcome file to be embedded in the installer.  It welcomes users to this
  installer.  Typically used in the graphical installers on Windows and Mac
  OS X.
235
236
237

.. variable:: CPACK_MONOLITHIC_INSTALL

238
239
240
241
242
  Disables the component-based installation mechanism.  When set, the
  component specification is ignored and all installed items are put in a
  single "MONOLITHIC" package.  Some CPack generators do monolithic
  packaging by default and may be asked to do component packaging by
  setting ``CPACK_<GENNAME>_COMPONENT_INSTALL`` to ``TRUE``.
243
244
245

.. variable:: CPACK_GENERATOR

246
247
248
  List of CPack generators to use.  If not specified, CPack will create a
  set of options following the naming pattern
  :variable:`CPACK_BINARY_<GENNAME>` (e.g. ``CPACK_BINARY_NSIS``) allowing
249
250
251
  the user to enable/disable individual generators.  If the :option:`-G <cpack -G>`
  option is given on the :manual:`cpack <cpack(1)>` command line, it will override
  this variable and any ``CPACK_BINARY_<GENNAME>`` options.
252
253
254

.. variable:: CPACK_OUTPUT_CONFIG_FILE

255
256
257
  The name of the CPack binary configuration file.  This file is the CPack
  configuration generated by the CPack module for binary installers.
  Defaults to ``CPackConfig.cmake``.
258
259
260

.. variable:: CPACK_PACKAGE_EXECUTABLES

261
262
263
264
  Lists each of the executables and associated text label to be used to
  create Start Menu shortcuts.  For example, setting this to the list
  ``ccmake;CMake`` will create a shortcut named "CMake" that will execute the
  installed executable ``ccmake``.  Not all CPack generators use it (at least
265
  NSIS, and WIX do).
266
267
268

.. variable:: CPACK_STRIP_FILES

269
270
271
272
  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).
273
274
275

.. variable:: CPACK_VERBATIM_VARIABLES

276
277
  .. versionadded:: 3.4

278
279
280
281
282
283
  If set to ``TRUE``, values of variables prefixed with ``CPACK_`` will be
  escaped before being written to the configuration files, so that the cpack
  program receives them exactly as they were specified.  If not, characters
  like quotes and backslashes can cause parsing errors or alter the value
  received by the cpack program.  Defaults to ``FALSE`` for backwards
  compatibility.
284

285
286
287
288
289
290
291
292
293
.. variable:: CPACK_THREADS

  .. versionadded:: 3.20

  Number of threads to use when performing parallelized operations, such
  as compressing the installer package.

  Some compression methods used by CPack generators such as Debian or Archive
  may take advantage of multiple CPU cores to speed up compression.
294
295
296
297
298
299
300
301
302
303
304
  ``CPACK_THREADS`` can be set to specify how many threads will be
  used for compression.

  A positive integer can be used to specify an exact desired thread count.

  When given a negative integer CPack will use the absolute value
  as the upper limit but may choose a lower value based on
  the available hardware concurrency.

  Given 0 CPack will try to use all available CPU cores.

305
306
  By default ``CPACK_THREADS`` is set to ``1``.

307
308
309
310
311
  The following compression methods may take advantage of multiple cores:

  ``xz``
    Supported if CMake is built with a ``liblzma`` that supports
    parallel compression.
312

313
    .. versionadded:: 3.21
314

315
316
317
318
      Official CMake binaries available on ``cmake.org`` now ship
      with a ``liblzma`` that supports parallel compression.
      Older versions did not.

319
320
321
322
323
324
  ``zstd``
    .. versionadded:: 3.24

    Supported if CMake is built with libarchive 3.6 or higher.
    Official CMake binaries available on ``cmake.org`` support it.

325
  Other compression methods ignore this value and use only one thread.
326

327
328
329
Variables for Source Package Generators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

330
331
332
333
334
The following CPack variables are specific to source packages, and
will not affect binary packages:

.. variable:: CPACK_SOURCE_PACKAGE_FILE_NAME

335
  The name of the source package.  For example ``cmake-2.6.1``.
336
337
338

.. variable:: CPACK_SOURCE_STRIP_FILES

339
340
341
342
  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).
343
344
345

.. variable:: CPACK_SOURCE_GENERATOR

346
347
348
349
  List of generators used for the source packages.  As with
  :variable:`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.
350
351
352

.. variable:: CPACK_SOURCE_OUTPUT_CONFIG_FILE

353
354
355
  The name of the CPack source configuration file.  This file is the CPack
  configuration generated by the CPack module for source installers.
  Defaults to ``CPackSourceConfig.cmake``.
356
357
358

.. variable:: CPACK_SOURCE_IGNORE_FILES

359
360
361
362
  Pattern of files in the source tree that won't be packaged when building
  a source package.  This is a list of regular expression patterns (that
  must be properly escaped), e.g.,
  ``/CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*``
363

364
365
366
Variables for Advanced Use
^^^^^^^^^^^^^^^^^^^^^^^^^^

367
368
369
370
The following variables are for advanced uses of CPack:

.. variable:: CPACK_CMAKE_GENERATOR

371
372
373
  What CMake generator should be used if the project is a CMake
  project.  Defaults to the value of :variable:`CMAKE_GENERATOR`.  Few users
  will want to change this setting.
374
375
376

.. variable:: CPACK_INSTALL_CMAKE_PROJECTS

377
378
379
  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 installs everything.
380
381
382

.. variable:: CPACK_SYSTEM_NAME

383
384
  System name, defaults to the value of :variable:`CMAKE_SYSTEM_NAME`,
  except on Windows where it will be ``win32`` or ``win64``.
385
386
387

.. variable:: CPACK_PACKAGE_VERSION

388
389
390
391
  Package full version, used internally.  By default, this is built from
  :variable:`CPACK_PACKAGE_VERSION_MAJOR`,
  :variable:`CPACK_PACKAGE_VERSION_MINOR`, and
  :variable:`CPACK_PACKAGE_VERSION_PATCH`.
392
393
394

.. variable:: CPACK_TOPLEVEL_TAG

395
  Directory for the installed files.
396
397
398

.. variable:: CPACK_INSTALL_COMMANDS

399
400
401
402
403
404
  Extra commands to install components.  The environment variable
  ``CMAKE_INSTALL_PREFIX`` is set to the temporary install directory
  during execution.

.. variable:: CPACK_INSTALL_SCRIPTS

405
406
  .. versionadded:: 3.16

407
  Extra CMake scripts executed by CPack during its local staging
408
  installation.  They are executed before installing the files to be packaged.
409
410
411
412
413
414
415
  The scripts are not called by a standalone install (e.g.: ``make install``).
  For every script, the following variables will be set:
  :variable:`CMAKE_CURRENT_SOURCE_DIR`, :variable:`CMAKE_CURRENT_BINARY_DIR`
  and :variable:`CMAKE_INSTALL_PREFIX` (which is set to the staging install
  directory).  The singular form ``CMAKE_INSTALL_SCRIPT`` is supported as
  an alternative variable for historical reasons, but its value is ignored if
  ``CMAKE_INSTALL_SCRIPTS`` is set and a warning will be issued.
416

417
418
419
420
421
422
  See also :variable:`CPACK_PRE_BUILD_SCRIPTS` and
  :variable:`CPACK_POST_BUILD_SCRIPTS` which can be used to specify scripts
  to be executed later in the packaging process.

.. variable:: CPACK_PRE_BUILD_SCRIPTS

423
424
  .. versionadded:: 3.19

425
426
427
428
429
430
431
  List of CMake scripts to execute after CPack has installed the files to
  be packaged into a staging directory and before producing the package(s)
  from those files. See also :variable:`CPACK_INSTALL_SCRIPTS` and
  :variable:`CPACK_POST_BUILD_SCRIPTS`.

.. variable:: CPACK_POST_BUILD_SCRIPTS

432
433
  .. versionadded:: 3.19

434
435
436
437
438
439
440
  List of CMake scripts to execute after CPack has produced the resultant
  packages and before copying them back to the build directory.
  See also :variable:`CPACK_INSTALL_SCRIPTS`,
  :variable:`CPACK_PRE_BUILD_SCRIPTS` and :variable:`CPACK_PACKAGE_FILES`.

.. variable:: CPACK_PACKAGE_FILES

441
442
  .. versionadded:: 3.19

443
444
445
446
447
448
449
  List of package files created in the staging directory, with each file
  provided as a full absolute path.  This variable is populated by CPack
  just before invoking the post-build scripts listed in
  :variable:`CPACK_POST_BUILD_SCRIPTS`.  It is the preferred way for the
  post-build scripts to know the set of package files to operate on.
  Projects should not try to set this variable themselves.

450
451
.. variable:: CPACK_INSTALLED_DIRECTORIES

452
  Extra directories to install.
453
454
455

.. variable:: CPACK_PACKAGE_INSTALL_REGISTRY_KEY

456
457
458
  Registry key used when installing this project.  This is only used by
  installers for Windows.  The default value is based on the installation
  directory.
459
460
461

.. variable:: CPACK_CREATE_DESKTOP_LINKS

462
463
464
  List of desktop links to create.  Each desktop link requires a
  corresponding start menu shortcut as created by
  :variable:`CPACK_PACKAGE_EXECUTABLES`.
465
466
467

.. variable:: CPACK_BINARY_<GENNAME>

468
469
470
471
  CPack generated options for binary generators.  The ``CPack.cmake`` module
  generates (when :variable:`CPACK_GENERATOR` is not set) a set of CMake
  options (see CMake :command:`option` command) which may then be used to
  select the CPack generator(s) to be used when building the ``package``
472
473
  target or when running :manual:`cpack <cpack(1)>` without the
  :option:`-G <cpack -G>` option.
474

475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
.. variable:: CPACK_READELF_EXECUTABLE

  .. versionadded:: 3.25

  Specify the ``readelf`` executable path used by CPack.
  The default value will be ``CMAKE_READELF`` when set.  Otherwise,
  the default value will be empty and CPack will use :command:`find_program`
  to determine the ``readelf`` path when needed.

.. variable:: CPACK_OBJCOPY_EXECUTABLE

  .. versionadded:: 3.25

  Specify the ``objcopy`` executable path used by CPack.
  The default value will be ``CMAKE_OBJCOPY`` when set.  Otherwise,
  the default value will be empty and CPack will use :command:`find_program`
  to determine the ``objcopy`` path when needed.

.. variable:: CPACK_OBJDUMP_EXECUTABLE

  .. versionadded:: 3.25

  Specify the ``objdump`` executable path used by CPack.
  The default value will be ``CMAKE_OBJDUMP`` when set.  Otherwise,
  the default value will be empty and CPack will use :command:`find_program`
  to determine the ``objdump`` path when needed.

502
#]=======================================================================]
503

504
# Define this var in order to avoid (or warn) concerning multiple inclusion
505
506
if(CPack_CMake_INCLUDED)
  message(WARNING "CPack.cmake has already been included!!")
507
else()
508
  set(CPack_CMake_INCLUDED 1)
509
endif()
510

511
# Pick a configuration file
512
513
514
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")
515
endif()
516
517
518
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")
519
endif()
520

521
522
523
# Backward compatibility
# Include CPackComponent macros if it has not already been included before.
include(CPackComponent)
524

525
# Macro for setting values if a user did not overwrite them
526
# Mangles CMake-special characters. Only kept for backwards compatibility.
527
macro(cpack_set_if_not_set name value)
528
529
  message(DEPRECATION "cpack_set_if_not_set is obsolete; do not use.")
  _cpack_set_default("${name}" "${value}")
530
endmacro()
531

532
# cpack_encode_variables - Function to encode variables for the configuration file
533
# find any variable that starts with CPACK and create a variable
Bill Hoffman's avatar
Bill Hoffman committed
534
535
# _CPACK_OTHER_VARIABLES_ that contains SET commands for
# each cpack variable.  _CPACK_OTHER_VARIABLES_ is then
536
# used as an @ replacement in configure_file for the CPackConfig.
537
538
function(cpack_encode_variables)
  set(commands "")
539
540
  get_cmake_property(res VARIABLES)
  foreach(var ${res})
541
    if(var MATCHES "^CPACK")
542
543
544
545
      if(CPACK_VERBATIM_VARIABLES)
        _cpack_escape_for_cmake(value "${${var}}")
      else()
        set(value "${${var}}")
546
      endif()
547

548
      string(APPEND commands "\nset(${var} \"${value}\")")
549
    endif()
550
  endforeach()
551
552
553

  set(_CPACK_OTHER_VARIABLES_ "${commands}" PARENT_SCOPE)
endfunction()
554

555
556
557
558
559
560
561
# Internal use functions
function(_cpack_set_default name value)
  if(NOT DEFINED "${name}")
    set("${name}" "${value}" PARENT_SCOPE)
  endif()
endfunction()

562
563
564
565
566
function(_cpack_escape_for_cmake var value)
  string(REGEX REPLACE "([\\\$\"])" "\\\\\\1" escaped "${value}")
  set("${var}" "${escaped}" PARENT_SCOPE)
endfunction()

567
# Set the package name
568
_cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
569
570
571

# Set the package version
if(CMAKE_PROJECT_VERSION_MAJOR GREATER_EQUAL 0)
Craig Scott's avatar
Craig Scott committed
572
  _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}")
573
  if(CMAKE_PROJECT_VERSION_MINOR GREATER_EQUAL 0)
Craig Scott's avatar
Craig Scott committed
574
    _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}")
575
    if(CMAKE_PROJECT_VERSION_PATCH GREATER_EQUAL 0)
Craig Scott's avatar
Craig Scott committed
576
      _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}")
577
    endif()
Craig Scott's avatar
Craig Scott committed
578
  endif()
579
else()
Craig Scott's avatar
Craig Scott committed
580
581
582
  _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0")
  _cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1")
  _cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1")
583
endif()
584
585
586
587
588
589
590
591
592
593
if(NOT DEFINED CPACK_PACKAGE_VERSION)
  set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}")
  if(CPACK_PACKAGE_VERSION_MINOR GREATER_EQUAL 0)
    string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_MINOR}")
    if(CPACK_PACKAGE_VERSION_PATCH GREATER_EQUAL 0)
      string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_PATCH}")
    endif()
  endif()
endif()

594
_cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity")
595
set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME} built using CMake")
596
597
598
599
600
if(CMAKE_PROJECT_DESCRIPTION)
  _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
    "${CMAKE_PROJECT_DESCRIPTION}")
else()
  _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY
601
    "${CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY}")
602
endif()
603
604
605
606
if(CMAKE_PROJECT_HOMEPAGE_URL)
  _cpack_set_default(CPACK_PACKAGE_HOMEPAGE_URL
    "${CMAKE_PROJECT_HOMEPAGE_URL}")
endif()
607

608
set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE
Andy Cedilnik's avatar
Andy Cedilnik committed
609
  "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
610
611
_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_FILE
  "${CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE}")
612
_cpack_set_default(CPACK_RESOURCE_FILE_LICENSE
613
  "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
614
_cpack_set_default(CPACK_RESOURCE_FILE_README
615
  "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
616
_cpack_set_default(CPACK_RESOURCE_FILE_WELCOME
617
  "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
618

619
_cpack_set_default(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
620

621
622
623
624
625
626
627
628
629
630
if(CMAKE_READELF)
  _cpack_set_default(CPACK_READELF_EXECUTABLE "${CMAKE_READELF}")
endif()
if(CMAKE_OBJCOPY)
  _cpack_set_default(CPACK_OBJCOPY_EXECUTABLE "${CMAKE_OBJCOPY}")
endif()
if(CMAKE_OBJDUMP)
  _cpack_set_default(CPACK_OBJDUMP_EXECUTABLE "${CMAKE_OBJDUMP}")
endif()

631
632
633
634
635
636
# Set default directory creation permissions mode
if(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS)
  _cpack_set_default(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
    "${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}")
endif()

637
638
if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL)
  set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
639
endif()
640
641
642

if(CPACK_NSIS_MODIFY_PATH)
  set(CPACK_NSIS_MODIFY_PATH ON)
643
endif()
644
645

set(__cpack_system_name ${CMAKE_SYSTEM_NAME})
646
647
if(__cpack_system_name MATCHES "Windows")
  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
648
    set(__cpack_system_name win64)
649
  else()
650
    set(__cpack_system_name win32)
651
652
  endif()
endif()
653
_cpack_set_default(CPACK_SYSTEM_NAME "${__cpack_system_name}")
654

655
656
# Root dir: default value should be the string literal "$PROGRAMFILES"
# for backwards compatibility. Projects may set this value to anything.
657
658
659
660
661
662
# When creating 64 bit binaries we set the default value to "$PROGRAMFILES64"
if("x${__cpack_system_name}" STREQUAL "xwin64")
  set(__cpack_root_default "$PROGRAMFILES64")
else()
  set(__cpack_root_default "$PROGRAMFILES")
endif()
663
_cpack_set_default(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
664

665
# <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
666
_cpack_set_default(CPACK_PACKAGE_FILE_NAME
667
  "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
668
_cpack_set_default(CPACK_PACKAGE_INSTALL_DIRECTORY
Andy Cedilnik's avatar
Andy Cedilnik committed
669
  "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
670
_cpack_set_default(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
671
  "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
672
673
_cpack_set_default(CPACK_PACKAGE_DEFAULT_LOCATION "/")
_cpack_set_default(CPACK_PACKAGE_RELOCATABLE "true")
674
675
676
677

# always force to exactly "true" or "false" for CPack.Info.plist.in:
if(CPACK_PACKAGE_RELOCATABLE)
  set(CPACK_PACKAGE_RELOCATABLE "true")
678
else()
679
  set(CPACK_PACKAGE_RELOCATABLE "false")
680
endif()
681

Alexander Neundorf's avatar
   
Alexander Neundorf committed
682
683
684
macro(cpack_check_file_exists file description)
  if(NOT EXISTS "${file}")
    message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
685
686
  endif()
endmacro()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
687

688
689
690
691
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")
692

Alexander Neundorf's avatar
   
Alexander Neundorf committed
693
694
695
macro(cpack_optional_append _list _cond _item)
  if(${_cond})
    set(${_list} ${${_list}} ${_item})
696
697
  endif()
endmacro()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
698

699
700
701
# Provide options to choose generators we might check here if the required
# tools for the generators exist and set the defaults according to the
# results.
Alexander Neundorf's avatar
   
Alexander Neundorf committed
702
703
704
if(NOT CPACK_GENERATOR)
  if(UNIX)
    if(CYGWIN)
705
      option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
706
    else()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
707
      if(APPLE)
708
        option(CPACK_BINARY_BUNDLE       "Enable to build OSX bundles"      OFF)
709
        option(CPACK_BINARY_DRAGNDROP    "Enable to build OSX Drag And Drop package" OFF)
710
        option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF)
711
712
713
714
715
        mark_as_advanced(
          CPACK_BINARY_BUNDLE
          CPACK_BINARY_DRAGNDROP
          CPACK_BINARY_PRODUCTBUILD
          )
716
      else()
717
        option(CPACK_BINARY_TZ  "Enable to build TZ packages"     ON)
718
        mark_as_advanced(CPACK_BINARY_TZ)
719
      endif()
720
      option(CPACK_BINARY_DEB  "Enable to build Debian packages"  OFF)
721
      option(CPACK_BINARY_FREEBSD  "Enable to build FreeBSD packages"  OFF)
722
723
      option(CPACK_BINARY_NSIS "Enable to build NSIS packages"    OFF)
      option(CPACK_BINARY_RPM  "Enable to build RPM packages"     OFF)
724
      option(CPACK_BINARY_STGZ "Enable to build STGZ packages"    ON)
725
      option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages"    OFF)
726
      option(CPACK_BINARY_TGZ  "Enable to build TGZ packages"     ON)
727
      option(CPACK_BINARY_TXZ  "Enable to build TXZ packages"     OFF)
728
729
730
731
732
733
734
735
736
737
      mark_as_advanced(
        CPACK_BINARY_DEB
        CPACK_BINARY_FREEBSD
        CPACK_BINARY_NSIS
        CPACK_BINARY_RPM
        CPACK_BINARY_STGZ
        CPACK_BINARY_TBZ2
        CPACK_BINARY_TGZ
        CPACK_BINARY_TXZ
        )
738
739
    endif()
  else()
Alex Turbov's avatar
Alex Turbov committed
740
741
742
743
744
    option(CPACK_BINARY_7Z    "Enable to build 7-Zip packages" OFF)
    option(CPACK_BINARY_NSIS  "Enable to build NSIS packages" ON)
    option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF)
    option(CPACK_BINARY_WIX   "Enable to build WiX packages" OFF)
    option(CPACK_BINARY_ZIP   "Enable to build ZIP packages" OFF)
745
746
747
748
749
750
751
    mark_as_advanced(
      CPACK_BINARY_7Z
      CPACK_BINARY_NSIS
      CPACK_BINARY_NUGET
      CPACK_BINARY_WIX
      CPACK_BINARY_ZIP
      )
752
  endif()
753
  option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF)
754
  mark_as_advanced(CPACK_BINARY_IFW)
755

756
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_7Z           7Z)
757
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_BUNDLE       Bundle)
758
759
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_CYGWIN       CygwinBinary)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DEB          DEB)
760
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DRAGNDROP    DragNDrop)
761
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_FREEBSD      FREEBSD)
762
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_IFW          IFW)
763
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NSIS         NSIS)
Alex Turbov's avatar
Alex Turbov committed
764
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NUGET        NuGet)
765
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PRODUCTBUILD productbuild)
766
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_RPM          RPM)
767
768
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_STGZ         STGZ)
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TBZ2         TBZ2)
769
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TGZ          TGZ)
770
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TXZ          TXZ)
771
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TZ           TZ)
772
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_WIX          WIX)
773
  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_ZIP          ZIP)
774

775
endif()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
776
777
778
779
780
781

# 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)
782
      mark_as_advanced(CPACK_SOURCE_CYGWIN)
783
    else()
784
      option(CPACK_SOURCE_RPM  "Enable to build RPM source packages"  OFF)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
785
786
      option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
      option(CPACK_SOURCE_TGZ  "Enable to build TGZ source packages"  ON)
787
      option(CPACK_SOURCE_TXZ  "Enable to build TXZ source packages"  ON)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
788
789
      option(CPACK_SOURCE_TZ   "Enable to build TZ source packages"   ON)
      option(CPACK_SOURCE_ZIP  "Enable to build ZIP source packages"  OFF)
790
791
792
793
794
795
796
797
      mark_as_advanced(
        CPACK_SOURCE_RPM
        CPACK_SOURCE_TBZ2
        CPACK_SOURCE_TGZ
        CPACK_SOURCE_TXZ
        CPACK_SOURCE_TZ
        CPACK_SOURCE_ZIP
        )
798
799
    endif()
  else()
800
    option(CPACK_SOURCE_7Z  "Enable to build 7-Zip source packages" ON)
801
    option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
802
803
804
805
    mark_as_advanced(
      CPACK_SOURCE_7Z
      CPACK_SOURCE_ZIP
      )
806
  endif()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
807

808
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_7Z      7Z)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
809
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_CYGWIN  CygwinSource)
810
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_RPM     RPM)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
811
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TBZ2    TBZ2)
812
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TGZ     TGZ)
813
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TXZ     TXZ)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
814
815
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TZ      TZ)
  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_ZIP     ZIP)
816
endif()
817
818

# Set some other variables
819
_cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS
820
  "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
821
822
_cpack_set_default(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
_cpack_set_default(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
823
_cpack_set_default(CPACK_THREADS 1)
824
825
# if the user has set CPACK_NSIS_DISPLAY_NAME remember it
if(DEFINED CPACK_NSIS_DISPLAY_NAME)
826
  set(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
827
828
829
830
endif()
# if the user has set CPACK_NSIS_DISPLAY
# explicitly, then use that as the default
# value of CPACK_NSIS_PACKAGE_NAME  instead
831
# of CPACK_PACKAGE_INSTALL_DIRECTORY
832
_cpack_set_default(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
833
834
# Specify the name of the Uninstall file in NSIS
_cpack_set_default(CPACK_NSIS_UNINSTALL_NAME "Uninstall")
835
836

if(CPACK_NSIS_DISPLAY_NAME_SET)
837
  _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_NSIS_DISPLAY_NAME}")
838
else()
839
  _cpack_set_default(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
840
endif()
841

842
_cpack_set_default(CPACK_OUTPUT_CONFIG_FILE
843
844
  "${CMAKE_BINARY_DIR}/CPackConfig.cmake")

845
_cpack_set_default(CPACK_SOURCE_OUTPUT_CONFIG_FILE
846
847
  "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")

848
849
_cpack_set_default(CPACK_SET_DESTDIR OFF)
_cpack_set_default(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
850

851
852
_cpack_set_default(CPACK_NSIS_INSTALLER_ICON_CODE "")
_cpack_set_default(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
853

854
# DragNDrop specific variables
855
856
857
858
859
860
861
862
863
864
865
866
867
868
if(NOT DEFINED CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE
    AND CPACK_RESOURCE_FILE_LICENSE AND NOT CPACK_RESOURCE_FILE_LICENSE STREQUAL "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
  cmake_policy(GET CMP0133 _CPack_CMP0133)
  if(NOT "x${_CPack_CMP0133}x" STREQUAL "xNEWx")
    if(NOT "x${_CPack_CMP0133}x" STREQUAL "xOLDx" AND CMAKE_POLICY_WARNING_CMP0133)
      cmake_policy(GET_WARNING CMP0133 _CMP0133_warning)
      message(AUTHOR_WARNING
        "${_CMP0133_warning}\n"
        "For compatibility, CMake will enable the SLA in the CPack DragNDrop Generator."
        )
    endif()
    _cpack_set_default(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE ON)
  endif()
  unset(_CPack_CMP0133)
869
870
endif()

871
# WiX specific variables
872
_cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
873

874
# set sysroot so SDK tools can be used
875
if(CMAKE_OSX_SYSROOT)
876
  _cpack_set_default(CPACK_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}")
877
878
endif()

879
880
_cpack_set_default(CPACK_BUILD_SOURCE_DIRS "${CMAKE_SOURCE_DIR};${CMAKE_BINARY_DIR}")

881
882
883
884
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)
885
  else()
886
887
    # The user has provided the set of components to be installed as
    # part of a component-based installation; trust her.
888
    set(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
889
890
  endif()
else()
891
892
893
  # If the user has not specifically requested a monolithic installer
  # but has specified components in various "install" commands, tell
  # CPack about those components.
894
895
896
897
  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)
898
899
900
      # 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).
901
      set(CPACK_COMPONENTS_ALL)
902
    endif()
903
    set(CPACK_COMPONENTS_LEN)
904
905
  endif()
endif()
906
907
908
909
910
911
912
913

# 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)

Bill Hoffman's avatar
Bill Hoffman committed
914
cpack_encode_variables()
915
configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY)
916

917
# Generate source file
918
_cpack_set_default(CPACK_SOURCE_INSTALLED_DIRECTORIES
919
  "${CMAKE_SOURCE_DIR};/")
920
921
_cpack_set_default(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
_cpack_set_default(CPACK_SOURCE_PACKAGE_FILE_NAME
922
  "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
923
924
925
926
927
928
929
930
931

set(__cpack_source_ignore_files_default
  "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#")
if(NOT CPACK_VERBATIM_VARIABLES)
  _cpack_escape_for_cmake(__cpack_source_ignore_files_default
    "${__cpack_source_ignore_files_default}")
endif()
_cpack_set_default(CPACK_SOURCE_IGNORE_FILES "${__cpack_source_ignore_files_default}")

932
933
934
935
936
937
938
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}")
939

940
941
set(CPACK_RPM_PACKAGE_SOURCES "ON")

942
cpack_encode_variables()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
943
configure_file("${cpack_source_input_file}"
944
  "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY)