1 # ============================================================================ 2 # Copyright (c) 2011-2012 University of Pennsylvania 3 # Copyright (c) 2013-2016 Andreas Schuh 6 # See COPYING file for license information or visit 7 # https://cmake-basis.github.io/download.html#license 8 # ============================================================================ 10 ############################################################################## 11 # @file BasisPack.cmake 12 # @brief CPack configuration. Include this module instead of CPack. 14 # @note This module is included by basis_project_finalize(). 16 # This module implements the packaging of BASIS projects. 18 # Overwrite the package information set by this module either in a file 19 # Package.cmake or a file Package.cmake.in located in the directory 20 # specified by PROJECT_CONFIG_DIR. The latter is configured and copied to the 21 # binary tree before included by this module. Further, to enable a 22 # component-based installation, provide either a file Components.cmake or 23 # Components.cmake.in again in the directory specified by PROJECT_CONFIG_DIR. 24 # Also in this case, the latter is configured via CMake's configure_file() 25 # before use. This file is referred to as components definition (file). 27 # Components can be added in the components definition using the command 28 # basis_add_component(). Several components can be grouped together and a 29 # group description be added using the command basis_add_component_group(). 30 # Different pre-configured install types which define a certain selection of 31 # components to install can be added using basis_add_install_type(). 32 # Note that all these BASIS functions are wrappers around the corresponding 36 # @sa http://www.vtk.org/Wiki/CMake:Component_Install_With_CPack#Component-Based_Installers_with_CPack 39 ############################################################################## 41 # ============================================================================ 43 # ============================================================================ 48 # ============================================================================ 50 # ============================================================================ 52 # find required runtime libraries 53 set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) 54 include (InstallRequiredSystemLibraries) 56 # include system runtime libraries in the installation 57 if (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) 60 PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} 61 DESTINATION ${INSTALL_RUNTIME_DIR} 65 PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} 66 DESTINATION ${INSTALL_LIBRARY_DIR} 71 # ============================================================================ 73 # ============================================================================ 76 set (CPACK_PACKAGE_NAME "${PROJECT_PACKAGE_NAME}
") 77 set (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}
") 78 set (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}
") 79 set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}
") 80 set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}
") 81 set (CPACK_PACKAGE_CONTACT "${PROJECT_CONTACT}
") 82 set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}
") 83 if (PROJECT_README_FILE) 84 set (CPACK_RESOURCE_FILE_README "${PROJECT_README_FILE}
") 86 if (PROJECT_COPYING_FILE) 87 set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_COPYING_FILE}
") 90 if (PROJECT_PROVIDER_NAME AND PROJECT_DIVISION_NAME) 91 set (CPACK_PACKAGE_VENDOR "${PROJECT_DIVISION_NAME}, ${PROJECT_PROVIDER_NAME}
") 92 elseif (PROJECT_PROVIDER_NAME) 93 set (CPACK_PACKAGE_VENDOR "${PROJECT_PROVIDER_NAME}
") 94 elseif (PROJECT_DIVISION_NAME) 95 set (CPACK_PACKAGE_VENDOR "${PROJECT_DIVISION_NAME}
") 96 elseif (PROJECT_PACKAGE_VENDOR) 97 set (CPACK_PACKAGE_VENDOR "${PROJECT_PACKAGE_VENDOR}
") 99 set (CPACK_PACKAGE_VENDOR "") 102 if (PROJECT_INSTALL_FILE) 103 set (CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_INSTALL_FILE}
") 105 if (PROJECT_WELCOME_FILE) 106 set (CPACK_RESOURCE_FILE_WELCOME "${PROJECT_WELCOME_FILE}
") 110 set (CPACK_PACKAGE_RELOCATABLE "true") 113 string (TOLOWER "${CMAKE_SYSTEM_NAME}
" CPACK_SYSTEM_NAME) 114 if (${CPACK_SYSTEM_NAME} MATCHES "windows
") 116 set (CPACK_SYSTEM_NAME "win64
") 118 set (CPACK_SYSTEM_NAME "win32
") 123 set (CPACK_GENERATOR "TGZ
") 124 set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY "1
") 126 set (CPACK_PACKAGE_FILE_NAME "${PROJECT_PACKAGE_NAME_L}-${PROJECT_VERSION}-${
CPACK_SYSTEM_NAME}
") 127 if (CMAKE_SYSTEM_PROCESSOR) 132 set (CPACK_SOURCE_GENERATOR "TGZ
") 134 set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_PACKAGE_NAME_L}-${PROJECT_VERSION}-source
") 136 # ---------------------------------------------------------------------------- 137 # TODO The proper values for the following options still need to be 138 # figured. For the moment, just ignore these settings. NSIS might 139 # anyways not be supported in the near future. 140 # ---------------------------------------------------------------------------- 142 if (WIN32 AND NOT UNIX) 143 # There is a bug in NSI that does not handle full unix paths properly. Make 144 # sure there is at least one set of four (4) backlasshes. 145 # set (CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp
") 146 # set (CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe
") 147 # set (CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}
") 148 # set (CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.my-project-home-page.org
") 149 # set (CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com
") 150 set (CPACK_NSIS_CONTACT "${PROJECT_CONTACT}
") 151 set (CPACK_NSIS_MODIFY_PATH "ON
") 153 # set (CPACK_STRIP_FILES "bin/MyExecutable
") 154 # set (CPACK_SOURCE_STRIP_FILES "") 157 # ============================================================================ 159 # ============================================================================ 161 ## @brief Patterns to be ignored when creating source package. 162 # @ingroup BasisSettings 163 list (APPEND CPACK_SOURCE_IGNORE_FILES 172 "/${_TEST_DIR}/
internal/
" 175 # exclude disabled modules from source package 176 if (PROJECT_MODULES_DISABLED) 177 foreach (_M ${PROJECT_MODULES_DISABLED}) 178 list (APPEND CPACK_SOURCE_IGNORE_FILES "/${_MODULES_DIR}/${_M}/
") 182 # ============================================================================ 183 # include project package information 184 # ============================================================================ 188 "${PROJECT_BINARY_DIR}/Package.cmake
" @ONLY) 189 include ("${PROJECT_BINARY_DIR}/Package.cmake
") 194 # ============================================================================ 196 # ============================================================================ 200 # ============================================================================ 202 # ============================================================================ 204 # ---------------------------------------------------------------------------- 206 # ---------------------------------------------------------------------------- 208 ## @addtogroup CMakeAPI 212 # ---------------------------------------------------------------------------- 213 ## @brief Add component group. 215 # @attention This functionality is not yet entirely implemented. 216 # @todo Come up and implement components concept which fits into superproject concept. 218 # @param [in] GRPNAME Name of the component group. 219 # @param [in] ARGN Further arguments passed to cpack_add_component_group(). 221 # @returns Adds the component group @p GRPNAME. 223 # @sa http://www.cmake.org/pipermail/cmake/2008-August/023336.html 224 # @sa cpack_add_component_group() 225 function (basis_add_component_group GRPNAME) 229 foreach (ARG ${ARGN}) 231 set (${OPTION_NAME} "${ARG}
") 235 if (ARG MATCHES "^PARENT_GROUP$
") 236 set (OPTION_NAME "PARENT_GROUP
") 241 cpack_add_component_group (${GRPNAME} ${ARGN}) 243 add_custom_target (install_${GRPNAME}) 246 add_dependencies (install_${PARENT_GROUP} install_${GRPNAME}) 250 # ---------------------------------------------------------------------------- 251 ## @brief Add component. 253 # @attention This functionality is not yet entirely implemented. 254 # @todo Come up and implement components concept which fits into superproject concept. 256 # @param [in] COMPNAME Name of the component. 257 # @param [in] ARGN Further arguments passed to cpack_add_component(). 259 # @returns Adds the component named @p COMPNAME. 261 # @sa http://www.cmake.org/pipermail/cmake/2008-August/023336.html 262 # @sa cpack_add_component() 263 function (basis_add_component COMPNAME) 267 foreach (ARG ${ARGN}) 269 set (${OPTION_NAME} "${ARG}
") 273 if (ARG MATCHES "^GROUP$
") 274 set (OPTION_NAME "GROUP
") 279 cpack_add_component (${COMPNAME} ${ARGN}) 283 COMMAND "${CMAKE_COMMAND}
" -DCOMPONENT=${COMPNAME} 284 -P "${PROJECT_BINARY_DIR}/cmake_install.cmake
" 288 add_dependencies (install_${GROUP} install_${COMPNAME}) 292 # ---------------------------------------------------------------------------- 293 ## @brief Add pre-configured install type. 295 # @param [in] ARGN Arguments for cpack_add_install_type(). 297 # @returns Adds a pre-configured installation type. 300 # @sa cpack_add_install_type () 301 function (basis_add_install_type) 302 cpack_add_install_type (${ARGN}) 305 # ---------------------------------------------------------------------------- 306 ## @brief Configure installation-time downloads of selected components. 308 # @param [in] ARGN Arguments for cpack_configure_downloads(). 313 # @sa cpack_configure_downloads() 314 function (basis_configure_downloads) 315 cpack_configure_downloads (${ARGN}) 320 # end of Doxygen group 323 # ---------------------------------------------------------------------------- 324 # include components definition 325 # ---------------------------------------------------------------------------- 329 "${PROJECT_BINARY_DIR}/Components.cmake
" @ONLY) 330 include ("${PROJECT_BINARY_DIR}/Components.cmake
") 335 # ============================================================================ 337 # ============================================================================ cmake CMAKE_INSTALL_PREFIX
Installation prefix, i.e., root directory of installation.
function basis_get_relative_path(out REL, in BASE, in PATH)
Get path relative to a given base directory.
cmake PROJECT_MODULES_DIR
Absolute path to directory containing project modules in subdirectories.
cmake PROJECT_CONFIG_DIR
Absolute path to directory of BASIS project configuration in source tree.
cmake CPACK_PACKAGE_FILE_NAME