CPack.cmake 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. ##section Variables common to all CPack generators
  2. ##end
  3. ##module
  4. # - Build binary and source package installers.
  5. # The CPack module generates binary and source installers in a variety
  6. # of formats using the cpack program. Inclusion of the CPack module
  7. # adds two new targets to the resulting makefiles, package and
  8. # package_source, which build the binary and source installers,
  9. # respectively. The generated binary installers contain everything
  10. # installed via CMake's INSTALL command (and the deprecated
  11. # INSTALL_FILES, INSTALL_PROGRAMS, and INSTALL_TARGETS commands).
  12. #
  13. # For certain kinds of binary installers (including the graphical
  14. # installers on Mac OS X and Windows), CPack generates installers that
  15. # allow users to select individual application components to
  16. # install. See CPackComponent module for that.
  17. #
  18. # The CPACK_GENERATOR variable has different meanings in different
  19. # contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a
  20. # *list of generators*: when run with no other arguments, CPack
  21. # will iterate over that list and produce one package for each
  22. # generator. In a CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR
  23. # is a *string naming a single generator*. If you need per-cpack-
  24. # generator logic to control *other* cpack settings, then you need
  25. # a CPACK_PROJECT_CONFIG_FILE.
  26. #
  27. # The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE.
  28. # See the top level file CMakeCPackOptions.cmake.in for an example.
  29. #
  30. # If set, the CPACK_PROJECT_CONFIG_FILE is included automatically
  31. # on a per-generator basis. It only need contain overrides.
  32. #
  33. # Here's how it works:
  34. # - cpack runs
  35. # - it includes CPackConfig.cmake
  36. # - it iterates over the generators listed in that file's
  37. # CPACK_GENERATOR list variable (unless told to use just a
  38. # specific one via -G on the command line...)
  39. #
  40. # - foreach generator, it then
  41. # - sets CPACK_GENERATOR to the one currently being iterated
  42. # - includes the CPACK_PROJECT_CONFIG_FILE
  43. # - produces the package for that generator
  44. #
  45. # This is the key: For each generator listed in CPACK_GENERATOR
  46. # in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR
  47. # internally to *the one currently being used* and then include
  48. # the CPACK_PROJECT_CONFIG_FILE.
  49. #
  50. # Before including this CPack module in your CMakeLists.txt file,
  51. # there are a variety of variables that can be set to customize
  52. # the resulting installers. The most commonly-used variables are:
  53. ##end
  54. #
  55. ##variable
  56. # CPACK_PACKAGE_NAME - The name of the package (or application). If
  57. # not specified, defaults to the project name.
  58. ##end
  59. #
  60. ##variable
  61. # CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g.,
  62. # "Kitware").
  63. ##end
  64. #
  65. ##variable
  66. # CPACK_PACKAGE_VERSION_MAJOR - Package major Version
  67. ##end
  68. #
  69. ##variable
  70. # CPACK_PACKAGE_VERSION_MINOR - Package minor Version
  71. ##end
  72. #
  73. ##variable
  74. # CPACK_PACKAGE_VERSION_PATCH - Package patch Version
  75. ##end
  76. #
  77. ##variable
  78. # CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the
  79. # project. Used, for example, the introduction screen of a
  80. # CPack-generated Windows installer to describe the project.
  81. ##end
  82. #
  83. ##variable
  84. # CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the
  85. # project (only a few words).
  86. ##end
  87. #
  88. ##variable
  89. # CPACK_PACKAGE_FILE_NAME - The name of the package file to generate,
  90. # not including the extension. For example, cmake-2.6.1-Linux-i686.
  91. ##end
  92. #
  93. ##variable
  94. # CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the
  95. # target system, e.g., "CMake 2.5".
  96. ##end
  97. #
  98. ##variable
  99. # CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per
  100. # generator after setting CPACK_GENERATOR to the actual generator
  101. # being used. Allows per-generator setting of CPACK_* variables at
  102. # cpack time.
  103. ##end
  104. #
  105. ##variable
  106. # CPACK_RESOURCE_FILE_LICENSE - License file for the project, which
  107. # will typically be displayed to the user (often with an explicit
  108. # "Accept" button, for graphical installers) prior to installation.
  109. ##end
  110. #
  111. ##variable
  112. # CPACK_RESOURCE_FILE_README - ReadMe file for the project, which
  113. # typically describes in some detail
  114. ##end
  115. #
  116. ##variable
  117. # CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which
  118. # welcomes users to this installer. Typically used in the graphical
  119. # installers on Windows and Mac OS X.
  120. ##end
  121. #
  122. ##variable
  123. # CPACK_MONOLITHIC_INSTALL - Disables the component-based
  124. # installation mechanism, so that all components are always installed.
  125. ##end
  126. #
  127. ##variable
  128. # CPACK_GENERATOR - List of CPack generators to use. If not
  129. # specified, CPack will create a set of options (e.g.,
  130. # CPACK_BINARY_NSIS) allowing the user to enable/disable individual
  131. # generators.
  132. ##end
  133. #
  134. ##variable
  135. # CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file
  136. # for binary installers that will be generated by the CPack
  137. # module. Defaults to CPackConfig.cmake.
  138. ##end
  139. #
  140. ##variable
  141. # CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along
  142. # with a text label, to be used to create Start Menu shortcuts on
  143. # Windows. For example, setting this to the list ccmake;CMake will
  144. # create a shortcut named "CMake" that will execute the installed
  145. # executable ccmake.
  146. ##end
  147. #
  148. ##variable
  149. # CPACK_STRIP_FILES - List of files to be stripped. Starting with
  150. # CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which
  151. # enables stripping of all files (a list of files evaluates to TRUE
  152. # in CMake, so this change is compatible).
  153. ##end
  154. #
  155. # The following CPack variables are specific to source packages, and
  156. # will not affect binary packages:
  157. #
  158. ##variable
  159. # CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package,
  160. # e.g., cmake-2.6.1
  161. ##end
  162. #
  163. ##variable
  164. # CPACK_SOURCE_STRIP_FILES - List of files in the source tree that
  165. # will be stripped. Starting with CMake 2.6.0
  166. # CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables
  167. # stripping of all files (a list of files evaluates to TRUE in CMake,
  168. # so this change is compatible).
  169. ##end
  170. #
  171. ##variable
  172. # CPACK_SOURCE_GENERATOR - List of generators used for the source
  173. # packages. As with CPACK_GENERATOR, if this is not specified then
  174. # CPack will create a set of options (e.g., CPACK_SOURCE_ZIP)
  175. # allowing users to select which packages will be generated.
  176. ##end
  177. #
  178. ##variable
  179. # CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack
  180. # configuration file for source installers that will be generated by
  181. # the CPack module. Defaults to CPackSourceConfig.cmake.
  182. ##end
  183. #
  184. ##variable
  185. # CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree
  186. # that won't be packaged when building a source package. This is a
  187. # list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*
  188. ##end
  189. #
  190. # The following variables are for advanced uses of CPack:
  191. #
  192. ##variable
  193. # CPACK_CMAKE_GENERATOR - What CMake generator should be used if the
  194. # project is CMake project. Defaults to the value of CMAKE_GENERATOR;
  195. # few users will want to change this setting.
  196. ##end
  197. #
  198. ##variable
  199. # CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify
  200. # what project to install. The four values are: Build directory,
  201. # Project Name, Project Component, Directory. If omitted, CPack will
  202. # build an installer that installers everything.
  203. ##end
  204. #
  205. ##variable
  206. # CPACK_SYSTEM_NAME - System name, defaults to the value of
  207. # ${CMAKE_SYSTEM_NAME}.
  208. ##end
  209. #
  210. ##variable
  211. # CPACK_PACKAGE_VERSION - Package full version, used internally. By
  212. # default, this is built from CPACK_PACKAGE_VERSION_MAJOR,
  213. # CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH.
  214. ##end
  215. #
  216. ##variable
  217. # CPACK_TOPLEVEL_TAG - Directory for the installed files.
  218. ##end
  219. #
  220. ##variable
  221. # CPACK_INSTALL_COMMANDS - Extra commands to install components.
  222. ##end
  223. #
  224. ##variable
  225. # CPACK_INSTALLED_DIRECTORIES - Extra directories to install.
  226. ##end
  227. #
  228. #=============================================================================
  229. # Copyright 2006-2009 Kitware, Inc.
  230. #
  231. # Distributed under the OSI-approved BSD License (the "License");
  232. # see accompanying file Copyright.txt for details.
  233. #
  234. # This software is distributed WITHOUT ANY WARRANTY; without even the
  235. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  236. # See the License for more information.
  237. #=============================================================================
  238. # (To distribute this file outside of CMake, substitute the full
  239. # License text for the above reference.)
  240. # Define this var in order to avoid (or warn) concerning multiple inclusion
  241. IF(CPack_CMake_INCLUDED)
  242. MESSAGE(WARNING "CPack.cmake has already been included!!")
  243. ELSE(CPack_CMake_INCLUDED)
  244. SET(CPack_CMake_INCLUDED 1)
  245. ENDIF(CPack_CMake_INCLUDED)
  246. # Pick a configuration file
  247. SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
  248. IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  249. SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  250. ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
  251. SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
  252. IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  253. SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  254. ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
  255. # Backward compatibility
  256. # Include CPackComponent macros if it has not already been included before.
  257. include(CPackComponent)
  258. # Macro for setting values if a user did not overwrite them
  259. MACRO(cpack_set_if_not_set name value)
  260. IF(NOT DEFINED "${name}")
  261. SET(${name} "${value}")
  262. ENDIF(NOT DEFINED "${name}")
  263. ENDMACRO(cpack_set_if_not_set)
  264. # cpack_encode_variables - Macro to encode variables for the configuration file
  265. # find any variable that starts with CPACK and create a variable
  266. # _CPACK_OTHER_VARIABLES_ that contains SET commands for
  267. # each cpack variable. _CPACK_OTHER_VARIABLES_ is then
  268. # used as an @ replacment in configure_file for the CPackConfig.
  269. MACRO(cpack_encode_variables)
  270. SET(_CPACK_OTHER_VARIABLES_)
  271. GET_CMAKE_PROPERTY(res VARIABLES)
  272. FOREACH(var ${res})
  273. IF("xxx${var}" MATCHES "xxxCPACK")
  274. SET(_CPACK_OTHER_VARIABLES_
  275. "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
  276. ENDIF("xxx${var}" MATCHES "xxxCPACK")
  277. ENDFOREACH(var ${res})
  278. ENDMACRO(cpack_encode_variables)
  279. # Set the package name
  280. cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
  281. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
  282. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MINOR "1")
  283. cpack_set_if_not_set(CPACK_PACKAGE_VERSION_PATCH "1")
  284. cpack_set_if_not_set(CPACK_PACKAGE_VERSION
  285. "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
  286. cpack_set_if_not_set(CPACK_PACKAGE_VENDOR "Humanity")
  287. cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
  288. "${CMAKE_PROJECT_NAME} built using CMake")
  289. cpack_set_if_not_set(CPACK_PACKAGE_DESCRIPTION_FILE
  290. "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
  291. cpack_set_if_not_set(CPACK_RESOURCE_FILE_LICENSE
  292. "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
  293. cpack_set_if_not_set(CPACK_RESOURCE_FILE_README
  294. "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt")
  295. cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME
  296. "${CMAKE_ROOT}/Templates/CPack.GenericWelcome.txt")
  297. cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}")
  298. IF(CPACK_NSIS_MODIFY_PATH)
  299. SET(CPACK_NSIS_MODIFY_PATH ON)
  300. ENDIF(CPACK_NSIS_MODIFY_PATH)
  301. SET(__cpack_system_name ${CMAKE_SYSTEM_NAME})
  302. IF(${__cpack_system_name} MATCHES Windows)
  303. IF(CMAKE_CL_64)
  304. SET(__cpack_system_name win64)
  305. ELSE(CMAKE_CL_64)
  306. SET(__cpack_system_name win32)
  307. ENDIF(CMAKE_CL_64)
  308. ENDIF(${__cpack_system_name} MATCHES Windows)
  309. cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}")
  310. # Root dir: default value should be the string literal "$PROGRAMFILES"
  311. # for backwards compatibility. Projects may set this value to anything.
  312. set(__cpack_root_default "$PROGRAMFILES")
  313. cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}")
  314. # <project>-<major>.<minor>.<patch>-<release>-<platform>.<pkgtype>
  315. cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
  316. "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
  317. cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
  318. "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
  319. cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
  320. "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
  321. cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
  322. cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
  323. # always force to exactly "true" or "false" for CPack.Info.plist.in:
  324. if(CPACK_PACKAGE_RELOCATABLE)
  325. set(CPACK_PACKAGE_RELOCATABLE "true")
  326. else(CPACK_PACKAGE_RELOCATABLE)
  327. set(CPACK_PACKAGE_RELOCATABLE "false")
  328. endif(CPACK_PACKAGE_RELOCATABLE)
  329. macro(cpack_check_file_exists file description)
  330. if(NOT EXISTS "${file}")
  331. message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.")
  332. endif(NOT EXISTS "${file}")
  333. endmacro(cpack_check_file_exists)
  334. cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description")
  335. cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource")
  336. cpack_check_file_exists("${CPACK_RESOURCE_FILE_README}" "readme resource")
  337. cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource")
  338. macro(cpack_optional_append _list _cond _item)
  339. if(${_cond})
  340. set(${_list} ${${_list}} ${_item})
  341. endif(${_cond})
  342. endmacro(cpack_optional_append _list _cond _item)
  343. # Provide options to choose generators
  344. # we might check here if the required tools for the generates exist
  345. # and set the defaults according to the results
  346. if(NOT CPACK_GENERATOR)
  347. if(UNIX)
  348. if(CYGWIN)
  349. option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON)
  350. else(CYGWIN)
  351. if(APPLE)
  352. option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF)
  353. option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF)
  354. option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON)
  355. option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF)
  356. else(APPLE)
  357. option(CPACK_BINARY_TZ "Enable to build TZ packages" ON)
  358. endif(APPLE)
  359. option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON)
  360. option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON)
  361. option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF)
  362. option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF)
  363. option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF)
  364. option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF)
  365. endif(CYGWIN)
  366. else(UNIX)
  367. option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
  368. option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
  369. endif(UNIX)
  370. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle)
  371. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop)
  372. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker)
  373. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11)
  374. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_CYGWIN CygwinBinary)
  375. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DEB DEB)
  376. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
  377. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
  378. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ)
  379. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ)
  380. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
  381. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
  382. cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
  383. endif(NOT CPACK_GENERATOR)
  384. # Provide options to choose source generators
  385. if(NOT CPACK_SOURCE_GENERATOR)
  386. if(UNIX)
  387. if(CYGWIN)
  388. option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON)
  389. else(CYGWIN)
  390. option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
  391. option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON)
  392. option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON)
  393. option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF)
  394. endif(CYGWIN)
  395. else(UNIX)
  396. option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
  397. endif(UNIX)
  398. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource)
  399. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ)
  400. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2)
  401. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ)
  402. cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP)
  403. endif(NOT CPACK_SOURCE_GENERATOR)
  404. # mark the above options as advanced
  405. mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
  406. CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2
  407. CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
  408. CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
  409. CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
  410. CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
  411. # Set some other variables
  412. cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
  413. "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
  414. cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
  415. cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
  416. # if the user has set CPACK_NSIS_DISPLAY_NAME remember it
  417. if(DEFINED CPACK_NSIS_DISPLAY_NAME)
  418. SET(CPACK_NSIS_DISPLAY_NAME_SET TRUE)
  419. endif()
  420. # if the user has set CPACK_NSIS_DISPLAY
  421. # explicitly, then use that as the default
  422. # value of CPACK_NSIS_PACKAGE_NAME instead
  423. # of CPACK_PACKAGE_INSTALL_DIRECTORY
  424. cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
  425. if(CPACK_NSIS_DISPLAY_NAME_SET)
  426. string(REPLACE "\\" "\\\\"
  427. _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}")
  428. cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}")
  429. else()
  430. cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
  431. endif()
  432. cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
  433. "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
  434. cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
  435. "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
  436. cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
  437. cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
  438. cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
  439. cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
  440. IF(DEFINED CPACK_COMPONENTS_ALL)
  441. IF(CPACK_MONOLITHIC_INSTALL)
  442. MESSAGE("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")
  443. SET(CPACK_COMPONENTS_ALL)
  444. ELSE(CPACK_MONOLITHIC_INSTALL)
  445. # The user has provided the set of components to be installed as
  446. # part of a component-based installation; trust her.
  447. SET(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE)
  448. ENDIF(CPACK_MONOLITHIC_INSTALL)
  449. ELSE(DEFINED CPACK_COMPONENTS_ALL)
  450. # If the user has not specifically requested a monolithic installer
  451. # but has specified components in various "install" commands, tell
  452. # CPack about those components.
  453. IF(NOT CPACK_MONOLITHIC_INSTALL)
  454. GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS)
  455. LIST(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN)
  456. IF(CPACK_COMPONENTS_LEN EQUAL 1)
  457. # Only one component: this is not a component-based installation
  458. # (at least, it isn't a component-based installation, but may
  459. # become one later if the user uses the cpack_add_* commands).
  460. SET(CPACK_COMPONENTS_ALL)
  461. ENDIF(CPACK_COMPONENTS_LEN EQUAL 1)
  462. SET(CPACK_COMPONENTS_LEN)
  463. ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
  464. ENDIF(DEFINED CPACK_COMPONENTS_ALL)
  465. # CMake always generates a component named "Unspecified", which is
  466. # used to install everything that doesn't have an explicitly-provided
  467. # component. Since these files should always be installed, we'll make
  468. # them hidden and required.
  469. set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
  470. set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
  471. cpack_encode_variables()
  472. configure_file("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)
  473. # Generate source file
  474. cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
  475. "${CMAKE_SOURCE_DIR};/")
  476. cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source")
  477. cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
  478. "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
  479. cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
  480. "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#")
  481. SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
  482. SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
  483. SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
  484. SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
  485. SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
  486. SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
  487. SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}")
  488. cpack_encode_variables()
  489. configure_file("${cpack_source_input_file}"
  490. "${CPACK_SOURCE_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE)