2020-04-10 20:24:38 +00:00
|
|
|
# Общие настройки для пакета: организация, автор, версия
|
2021-06-07 14:46:58 +00:00
|
|
|
set(CPACK_PACKAGE_VENDOR ${CMLIB_ORGANIZATION_NAME_LOWER} CACHE STRING "")
|
|
|
|
set(CPACK_PACKAGE_NAME ${CMLIB_PROJECT_NAME_LOWER} CACHE STRING "")
|
|
|
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION} CACHE STRING "")
|
2020-04-10 20:24:38 +00:00
|
|
|
|
|
|
|
# Параметры для архива исходных текстов
|
2020-04-18 12:03:41 +00:00
|
|
|
if(NOT CPACK_SOURCE_GENERATOR)
|
2020-04-26 14:50:18 +00:00
|
|
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
2020-04-18 12:03:41 +00:00
|
|
|
endif()
|
2020-04-10 20:24:38 +00:00
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
|
|
|
|
|
2020-04-18 12:03:41 +00:00
|
|
|
# Типы генераторов для бинарных архивов
|
|
|
|
if(NOT CPACK_GENERATOR)
|
2020-04-26 14:50:18 +00:00
|
|
|
set(CPACK_GENERATOR "TGZ" "DEB")
|
2020-04-18 12:03:41 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-10 20:24:38 +00:00
|
|
|
# Параметры для архива собранного проекта
|
|
|
|
set(CPACK_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
|
|
|
set(CPACK_TARGET_ARCH "amd64")
|
|
|
|
endif()
|
2020-04-11 07:12:20 +00:00
|
|
|
set(CPACK_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}_${CPACK_TARGET_ARCH}_${CPACK_PACKAGE_VERSION}")
|
2020-04-10 20:24:38 +00:00
|
|
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
|
|
|
|
|
2020-04-18 12:03:41 +00:00
|
|
|
# Список масок для исключения из архива исходных текстов
|
|
|
|
set(CPACK_SOURCE_IGNORE_FILES
|
|
|
|
"${CPACK_SOURCE_IGNORE_FILES}"
|
|
|
|
"${CMAKE_BINARY_DIR}"
|
|
|
|
"^${CMAKE_SOURCE_DIR}/.?build.?/"
|
|
|
|
"^${CMAKE_SOURCE_DIR}/.?output.?/"
|
2021-05-25 11:59:59 +00:00
|
|
|
"^${CMAKE_SOURCE_DIR}/files/var"
|
2020-04-18 12:03:41 +00:00
|
|
|
"^${CMAKE_SOURCE_DIR}/files/log"
|
|
|
|
"CMakeLists.txt.user.*"
|
|
|
|
".*.autosave"
|
2020-04-24 19:47:58 +00:00
|
|
|
".*.status"
|
2020-04-18 12:03:41 +00:00
|
|
|
"~$"
|
|
|
|
"\\\\.swp$")
|
|
|
|
|
|
|
|
option(CMLIB_COMPACT_SOURCE_PACKAGE "Make compact source package" ON)
|
|
|
|
if(CMLIB_COMPACT_SOURCE_PACKAGE)
|
|
|
|
# Список масок для исключения из архива исходных текстов для более компактного архива
|
|
|
|
set(CPACK_SOURCE_IGNORE_FILES
|
|
|
|
"${CPACK_SOURCE_IGNORE_FILES}"
|
2020-04-24 19:47:58 +00:00
|
|
|
"\\\\.git"
|
2020-04-18 16:40:13 +00:00
|
|
|
"/\\\\.git/"
|
|
|
|
"/\\\\.gitlab-ci/"
|
|
|
|
"\\\\.clang-tidy$"
|
|
|
|
"\\\\.cmake-format$"
|
|
|
|
"\\\\.gitignore$"
|
|
|
|
"\\\\.gitattributes$"
|
|
|
|
"\\\\.gitmodules$"
|
|
|
|
"\\\\.gitlab-ci.yml$")
|
2020-04-18 12:03:41 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-10 20:24:38 +00:00
|
|
|
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/CMLibCPackProject.cmake)
|
|
|
|
|
2020-04-26 14:50:18 +00:00
|
|
|
option(CMLIB_CPACK_DEFAULT_SCHEME "Use packaging default scheme" ON)
|
|
|
|
|
|
|
|
# Правила для сборки обычных архивов
|
|
|
|
if(CMLIB_CPACK_DEFAULT_SCHEME)
|
|
|
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
|
|
|
|
set(CPACK_COMPONENTS_GROUPING IGNORE)
|
|
|
|
endif()
|
|
|
|
|
2020-04-10 20:24:38 +00:00
|
|
|
# Правила для сборки пакетов для Debian
|
|
|
|
include(CMLibCPackDeb)
|
|
|
|
|
|
|
|
# Подключение модуля, выполняющего сборку архивов и пакетов
|
|
|
|
include(CPack)
|