CMake/CMakeCPack.cmake

201 lines
7.6 KiB
CMake
Raw Normal View History

Simplify CMake per-source license notices Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
2016-09-27 19:01:08 +00:00
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
option(CMAKE_INSTALL_DEBUG_LIBRARIES
"Install Microsoft runtime debug libraries with CMake." FALSE)
mark_as_advanced(CMAKE_INSTALL_DEBUG_LIBRARIES)
# By default, do not warn when built on machines using only VS Express:
if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
endif()
Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148) Problem with CMake 2.8.4-rc1: when you launch the NSIS exe installer on Windows, the default install path shown to the end user is, at first, "\CMake 2.8". This problem started occurring when configuring CMake itself with an older CMake, after adding CPACK_NSIS_INSTALL_ROOT to fix issue 9148. So... it's a regression from 2.8.3. I forgot (again) that when you add a new CPack variable, you must add it to CMake's CMakeCPack.cmake file or else it is empty when configured with an older CMake. And on Windows, without a bootstrap build available, the releases are always configured with an older version of CMake. This may be the last time this has bitten me, though, because it is now burned into my brain that problems with CMake's installer itself are inevitably associated with adding new CPack variables. In addition to adding a definition for CPACK_NSIS_INSTALL_ROOT, I've gone ahead and made it differ for the 32- and 64-bit builds of CMake to give the end user the expected default value for the Program Files folder for each one. And, since I was adding a new 32/64 differentiator anyhow, I made the "NSIS package name" and "installer registry key base" different for 64-bit builds, too, by appending " (Win64)" to each one. These address the concerns mentioned in 9148's related issue: http://public.kitware.com/Bug/view.php?id=9094 (at least as far as CMake's installer is concerned). 9094 could still use a good general fix for all projects, though, and remains open for now.
2011-01-13 20:36:45 +00:00
if(CMake_INSTALL_DEPENDENCIES)
include(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
endif()
Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148) Problem with CMake 2.8.4-rc1: when you launch the NSIS exe installer on Windows, the default install path shown to the end user is, at first, "\CMake 2.8". This problem started occurring when configuring CMake itself with an older CMake, after adding CPACK_NSIS_INSTALL_ROOT to fix issue 9148. So... it's a regression from 2.8.3. I forgot (again) that when you add a new CPack variable, you must add it to CMake's CMakeCPack.cmake file or else it is empty when configured with an older CMake. And on Windows, without a bootstrap build available, the releases are always configured with an older version of CMake. This may be the last time this has bitten me, though, because it is now burned into my brain that problems with CMake's installer itself are inevitably associated with adding new CPack variables. In addition to adding a definition for CPACK_NSIS_INSTALL_ROOT, I've gone ahead and made it differ for the 32- and 64-bit builds of CMake to give the end user the expected default value for the Program Files folder for each one. And, since I was adding a new 32/64 differentiator anyhow, I made the "NSIS package name" and "installer registry key base" different for 64-bit builds, too, by appending " (Win64)" to each one. These address the concerns mentioned in 9148's related issue: http://public.kitware.com/Bug/view.php?id=9094 (at least as far as CMake's installer is concerned). 9094 could still use a good general fix for all projects, though, and remains open for now.
2011-01-13 20:36:45 +00:00
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CMake is a build tool")
set(CPACK_PACKAGE_VENDOR "Kitware")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
# Installers for 32- vs. 64-bit CMake:
# - Root install directory (displayed to end user at installer-run time)
# - "NSIS package/display name" (text used in the installer GUI)
# - Registry key used to store info about the installation
if(CMAKE_CL_64)
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
else()
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
endif()
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_NSIS_PACKAGE_NAME}")
if(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name
if("x${CMAKE_SYSTEM_NAME}" STREQUAL "xCYGWIN")
set(CPACK_SYSTEM_NAME Cygwin)
else()
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
endif()
endif()
if(${CPACK_SYSTEM_NAME} MATCHES Windows)
if(CMAKE_CL_64)
set(CPACK_SYSTEM_NAME win64-x64)
set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}")
else()
set(CPACK_SYSTEM_NAME win32-x86)
endif()
endif()
Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148) Problem with CMake 2.8.4-rc1: when you launch the NSIS exe installer on Windows, the default install path shown to the end user is, at first, "\CMake 2.8". This problem started occurring when configuring CMake itself with an older CMake, after adding CPACK_NSIS_INSTALL_ROOT to fix issue 9148. So... it's a regression from 2.8.3. I forgot (again) that when you add a new CPack variable, you must add it to CMake's CMakeCPack.cmake file or else it is empty when configured with an older CMake. And on Windows, without a bootstrap build available, the releases are always configured with an older version of CMake. This may be the last time this has bitten me, though, because it is now burned into my brain that problems with CMake's installer itself are inevitably associated with adding new CPack variables. In addition to adding a definition for CPACK_NSIS_INSTALL_ROOT, I've gone ahead and made it differ for the 32- and 64-bit builds of CMake to give the end user the expected default value for the Program Files folder for each one. And, since I was adding a new 32/64 differentiator anyhow, I made the "NSIS package name" and "installer registry key base" different for 64-bit builds, too, by appending " (Win64)" to each one. These address the concerns mentioned in 9148's related issue: http://public.kitware.com/Bug/view.php?id=9094 (at least as far as CMake's installer is concerned). 9094 could still use a good general fix for all projects, though, and remains open for now.
2011-01-13 20:36:45 +00:00
# Components
if(CMake_INSTALL_COMPONENTS)
set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack)
if(WIN32 AND NOT CYGWIN)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmcldeps)
endif()
if(APPLE)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild)
endif()
if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
else()
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified)
endif()
list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME})
string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}"
_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME)
if(BUILD_CursesDialog)
list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake)
endif()
if(BUILD_QtDialog)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui)
if(USE_LGPL)
set(_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES "set(CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES
\"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\")")
endif()
endif()
if(SPHINX_MAN)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man)
endif()
if(SPHINX_HTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html)
endif()
if(SPHINX_SINGLEHTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml)
endif()
if(SPHINX_QTHELP)
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
endif()
if(CMake_BUILD_DEVELOPER_REFERENCE)
if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html)
endif()
if(CMake_BUILD_DEVELOPER_REFERENCE_QTHELP)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-qthelp)
endif()
endif()
set(_CPACK_IFW_COMPONENTS_CONFIGURATION "
# Components
set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\")
set(CPACK_COMPONENTS_GROUPING IGNORE)
")
else()
if(BUILD_QtDialog AND USE_LGPL)
set(_CPACK_IFW_ADDITIONAL_LICENSES
"\"LGPLv${USE_LGPL}\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt\"")
endif()
endif()
# Components scripts configuration
foreach(_script
CMake
CMake.Documentation.SphinxHTML
CMake.DeveloperReference.HTML)
configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in"
"${CMake_BINARY_DIR}/${_script}.qs" @ONLY)
endforeach()
if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(_CPACK_IFW_PACKAGE_ICON
"set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
if(BUILD_QtDialog)
set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
endif()
if(SPHINX_HTML)
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")
endif()
if(CMake_BUILD_DEVELOPER_REFERENCE)
if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/developer-reference/html/index.html\", \"@StartMenuDir@/CMake Developer Reference.lnk\");\n")
endif()
endif()
configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
"${CMake_BINARY_DIR}/installscript.qs" @ONLY
)
install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
DESTINATION "${CMAKE_DOC_DIR}"
)
if(CMake_INSTALL_COMPONENTS)
set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/CMake.qs")
else()
set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/installscript.qs")
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}")
set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
endif()
set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not
# needed
if(CYGWIN)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
else()
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
endif()
endif()
Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148) Problem with CMake 2.8.4-rc1: when you launch the NSIS exe installer on Windows, the default install path shown to the end user is, at first, "\CMake 2.8". This problem started occurring when configuring CMake itself with an older CMake, after adding CPACK_NSIS_INSTALL_ROOT to fix issue 9148. So... it's a regression from 2.8.3. I forgot (again) that when you add a new CPack variable, you must add it to CMake's CMakeCPack.cmake file or else it is empty when configured with an older CMake. And on Windows, without a bootstrap build available, the releases are always configured with an older version of CMake. This may be the last time this has bitten me, though, because it is now burned into my brain that problems with CMake's installer itself are inevitably associated with adding new CPack variables. In addition to adding a definition for CPACK_NSIS_INSTALL_ROOT, I've gone ahead and made it differ for the 32- and 64-bit builds of CMake to give the end user the expected default value for the Program Files folder for each one. And, since I was adding a new 32/64 differentiator anyhow, I made the "NSIS package name" and "installer registry key base" different for 64-bit builds, too, by appending " (Win64)" to each one. These address the concerns mentioned in 9148's related issue: http://public.kitware.com/Bug/view.php?id=9094 (at least as far as CMake's installer is concerned). 9094 could still use a good general fix for all projects, though, and remains open for now.
2011-01-13 20:36:45 +00:00
set(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148) Problem with CMake 2.8.4-rc1: when you launch the NSIS exe installer on Windows, the default install path shown to the end user is, at first, "\CMake 2.8". This problem started occurring when configuring CMake itself with an older CMake, after adding CPACK_NSIS_INSTALL_ROOT to fix issue 9148. So... it's a regression from 2.8.3. I forgot (again) that when you add a new CPack variable, you must add it to CMake's CMakeCPack.cmake file or else it is empty when configured with an older CMake. And on Windows, without a bootstrap build available, the releases are always configured with an older version of CMake. This may be the last time this has bitten me, though, because it is now burned into my brain that problems with CMake's installer itself are inevitably associated with adding new CPack variables. In addition to adding a definition for CPACK_NSIS_INSTALL_ROOT, I've gone ahead and made it differ for the 32- and 64-bit builds of CMake to give the end user the expected default value for the Program Files folder for each one. And, since I was adding a new 32/64 differentiator anyhow, I made the "NSIS package name" and "installer registry key base" different for 64-bit builds, too, by appending " (Win64)" to each one. These address the concerns mentioned in 9148's related issue: http://public.kitware.com/Bug/view.php?id=9094 (at least as far as CMake's installer is concerned). 9094 could still use a good general fix for all projects, though, and remains open for now.
2011-01-13 20:36:45 +00:00
if(UNIX)
set(CPACK_STRIP_FILES "${CMAKE_BIN_DIR}/ccmake;${CMAKE_BIN_DIR}/cmake;${CMAKE_BIN_DIR}/cpack;${CMAKE_BIN_DIR}/ctest")
set(CPACK_SOURCE_STRIP_FILES "")
set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
endif()
Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148) Problem with CMake 2.8.4-rc1: when you launch the NSIS exe installer on Windows, the default install path shown to the end user is, at first, "\CMake 2.8". This problem started occurring when configuring CMake itself with an older CMake, after adding CPACK_NSIS_INSTALL_ROOT to fix issue 9148. So... it's a regression from 2.8.3. I forgot (again) that when you add a new CPack variable, you must add it to CMake's CMakeCPack.cmake file or else it is empty when configured with an older CMake. And on Windows, without a bootstrap build available, the releases are always configured with an older version of CMake. This may be the last time this has bitten me, though, because it is now burned into my brain that problems with CMake's installer itself are inevitably associated with adding new CPack variables. In addition to adding a definition for CPACK_NSIS_INSTALL_ROOT, I've gone ahead and made it differ for the 32- and 64-bit builds of CMake to give the end user the expected default value for the Program Files folder for each one. And, since I was adding a new 32/64 differentiator anyhow, I made the "NSIS package name" and "installer registry key base" different for 64-bit builds, too, by appending " (Win64)" to each one. These address the concerns mentioned in 9148's related issue: http://public.kitware.com/Bug/view.php?id=9094 (at least as far as CMake's installer is concerned). 9094 could still use a good general fix for all projects, though, and remains open for now.
2011-01-13 20:36:45 +00:00
set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991")
if(MSVC AND NOT "$ENV{WIX}" STREQUAL "")
set(WIX_CUSTOM_ACTION_ENABLED TRUE)
if(CMAKE_CONFIGURATION_TYPES)
set(WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE)
else()
set(WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE)
endif()
else()
set(WIX_CUSTOM_ACTION_ENABLED FALSE)
endif()
# Set the options file that needs to be included inside CMakeCPackOptions.cmake
set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake)
configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
"${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${CMake_BINARY_DIR}/CMakeCPackOptions.cmake")
Add CPACK_NSIS_INSTALL_ROOT for CMake's own installer (#9148) Problem with CMake 2.8.4-rc1: when you launch the NSIS exe installer on Windows, the default install path shown to the end user is, at first, "\CMake 2.8". This problem started occurring when configuring CMake itself with an older CMake, after adding CPACK_NSIS_INSTALL_ROOT to fix issue 9148. So... it's a regression from 2.8.3. I forgot (again) that when you add a new CPack variable, you must add it to CMake's CMakeCPack.cmake file or else it is empty when configured with an older CMake. And on Windows, without a bootstrap build available, the releases are always configured with an older version of CMake. This may be the last time this has bitten me, though, because it is now burned into my brain that problems with CMake's installer itself are inevitably associated with adding new CPack variables. In addition to adding a definition for CPACK_NSIS_INSTALL_ROOT, I've gone ahead and made it differ for the 32- and 64-bit builds of CMake to give the end user the expected default value for the Program Files folder for each one. And, since I was adding a new 32/64 differentiator anyhow, I made the "NSIS package name" and "installer registry key base" different for 64-bit builds, too, by appending " (Win64)" to each one. These address the concerns mentioned in 9148's related issue: http://public.kitware.com/Bug/view.php?id=9094 (at least as far as CMake's installer is concerned). 9094 could still use a good general fix for all projects, though, and remains open for now.
2011-01-13 20:36:45 +00:00
# include CPack model once all variables are set
include(CPack)