CMakeCPack.cmake 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #=============================================================================
  2. # CMake - Cross Platform Makefile Generator
  3. # Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. #
  5. # Distributed under the OSI-approved BSD License (the "License");
  6. # see accompanying file Copyright.txt for details.
  7. #
  8. # This software is distributed WITHOUT ANY WARRANTY; without even the
  9. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. # See the License for more information.
  11. #=============================================================================
  12. # If the cmake version includes cpack, use it
  13. if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
  14. if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
  15. option(CMAKE_INSTALL_DEBUG_LIBRARIES
  16. "Install Microsoft runtime debug libraries with CMake." FALSE)
  17. mark_as_advanced(CMAKE_INSTALL_DEBUG_LIBRARIES)
  18. # By default, do not warn when built on machines using only VS Express:
  19. if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
  20. set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
  21. endif()
  22. include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
  23. endif()
  24. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
  25. set(CPACK_PACKAGE_VENDOR "Kitware")
  26. set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
  27. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
  28. set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
  29. set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
  30. set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
  31. set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
  32. # Installers for 32- vs. 64-bit CMake:
  33. # - Root install directory (displayed to end user at installer-run time)
  34. # - "NSIS package/display name" (text used in the installer GUI)
  35. # - Registry key used to store info about the installation
  36. if(CMAKE_CL_64)
  37. set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
  38. set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
  39. else()
  40. set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
  41. set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
  42. endif()
  43. set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_NSIS_PACKAGE_NAME}")
  44. if(NOT DEFINED CPACK_SYSTEM_NAME)
  45. # make sure package is not Cygwin-unknown, for Cygwin just
  46. # cygwin is good for the system name
  47. if("x${CMAKE_SYSTEM_NAME}" STREQUAL "xCYGWIN")
  48. set(CPACK_SYSTEM_NAME Cygwin)
  49. else()
  50. set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
  51. endif()
  52. endif()
  53. if(${CPACK_SYSTEM_NAME} MATCHES Windows)
  54. if(CMAKE_CL_64)
  55. set(CPACK_SYSTEM_NAME win64-x64)
  56. set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}")
  57. else()
  58. set(CPACK_SYSTEM_NAME win32-x86)
  59. endif()
  60. endif()
  61. if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
  62. set(_CPACK_IFW_PACKAGE_ICON
  63. "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
  64. if(BUILD_QtDialog)
  65. set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
  66. endif()
  67. if(SPHINX_HTML)
  68. set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n")
  69. endif()
  70. configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
  71. "${CMake_BINARY_DIR}/installscript.qs" @ONLY
  72. )
  73. install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
  74. DESTINATION "."
  75. )
  76. set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")")
  77. endif()
  78. if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
  79. set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}")
  80. set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
  81. endif()
  82. set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
  83. if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
  84. # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
  85. # default to source package - system, on cygwin system is not
  86. # needed
  87. if(CYGWIN)
  88. set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
  89. else()
  90. set(CPACK_PACKAGE_FILE_NAME
  91. "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
  92. endif()
  93. endif()
  94. set(CPACK_PACKAGE_CONTACT "[email protected]")
  95. if(UNIX)
  96. set(CPACK_STRIP_FILES "bin/ccmake;bin/cmake;bin/cpack;bin/ctest")
  97. set(CPACK_SOURCE_STRIP_FILES "")
  98. set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
  99. endif()
  100. # cygwin specific packaging stuff
  101. if(CYGWIN)
  102. # setup the cygwin package name
  103. set(CPACK_PACKAGE_NAME cmake)
  104. # setup the name of the package for cygwin cmake-2.4.3
  105. set(CPACK_PACKAGE_FILE_NAME
  106. "${CPACK_PACKAGE_NAME}-${CMake_VERSION}")
  107. # the source has the same name as the binary
  108. set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
  109. # Create a cygwin version number in case there are changes for cygwin
  110. # that are not reflected upstream in CMake
  111. set(CPACK_CYGWIN_PATCH_NUMBER 1 CACHE STRING "patch number for CMake cygwin packages")
  112. mark_as_advanced(CPACK_CYGWIN_PATCH_NUMBER)
  113. # These files are required by the cmCPackCygwinSourceGenerator and the files
  114. # put into the release tar files.
  115. set(CPACK_CYGWIN_BUILD_SCRIPT
  116. "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.sh")
  117. set(CPACK_CYGWIN_PATCH_FILE
  118. "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.patch")
  119. # include the sub directory cmake file for cygwin that
  120. # configures some files and adds some install targets
  121. # this file uses some of the package file name variables
  122. include(Utilities/Release/Cygwin/CMakeLists.txt)
  123. endif()
  124. set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991")
  125. # Set the options file that needs to be included inside CMakeCPackOptions.cmake
  126. set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
  127. configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
  128. "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
  129. set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
  130. # include CPack model once all variables are set
  131. include(CPack)
  132. endif()