Добавлены значения по умолчанию для создания архивов

This commit is contained in:
Andrei Astafev 2020-04-18 15:03:41 +03:00
parent 9c6148ab82
commit d709a6d555
3 changed files with 49 additions and 16 deletions

View File

@ -4,9 +4,16 @@ set(CPACK_PACKAGE_NAME ${CMLIB_PROJECT_NAME_LOWER})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
# Параметры для архива исходных текстов
set(CPACK_SOURCE_GENERATOR TXZ)
if(NOT CPACK_SOURCE_GENERATOR)
set(CPACK_SOURCE_GENERATOR "TXZ")
endif()
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
# Типы генераторов для бинарных архивов
if(NOT CPACK_GENERATOR)
set(CPACK_GENERATOR "TXZ" "DEB")
endif()
# Параметры для архива собранного проекта
set(CPACK_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
@ -15,6 +22,35 @@ endif()
set(CPACK_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}_${CPACK_TARGET_ARCH}_${CPACK_PACKAGE_VERSION}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMLIB_PROJECT_NAME_LOWER}-${CPACK_PACKAGE_VERSION}")
# Список масок для исключения из архива исходных текстов
set(CPACK_SOURCE_IGNORE_FILES
"${CPACK_SOURCE_IGNORE_FILES}"
"${CMAKE_BINARY_DIR}"
"^${CMAKE_SOURCE_DIR}/.?build.?/"
"^${CMAKE_SOURCE_DIR}/.?output.?/"
"^${CMAKE_SOURCE_DIR}/files/lib"
"^${CMAKE_SOURCE_DIR}/files/log"
"CMakeLists.txt.user.*"
".*.autosave"
"~$"
"\\\\.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}"
"/\\\\.git/"
"/\\\\.gitlab-ci/"
"\\\\.clang-tidy$"
"\\\\.cmake-format$"
"\\\\.gitignore$"
"\\\\.gitattributes$"
"\\\\.gitmodules$"
"\\\\.gitlab-ci.yml$")
endif()
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/CMLibCPackProject.cmake)
# Правила для сборки пакетов для Debian

View File

@ -3,6 +3,18 @@ if(NOT DEBIAN_PACKAGE_TYPE)
set(DEBIAN_PACKAGE_TYPE "unstable")
endif()
if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
set(CPACK_DEBIAN_PACKAGE_SECTION "misc")
endif()
if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
endif()
#if(NOT CPACK_SOURCE_IGNORE_FILES)
# message(FATAL_ERROR "Required variable CPACK_SOURCE_IGNORE_FILES is not defined")
#endif()
# По умолчанию пакет для Debian делится на компоненты
if(NOT CPACK_DEB_COMPONENT_INSTALL)
set(CPACK_DEB_COMPONENT_INSTALL ON)

View File

@ -10,10 +10,6 @@ endif()
set(CPACK_PACKAGE_VENDOR ${ORGANIZATION_NAME})
if(NOT CPACK_GENERATOR)
message(FATAL_ERROR "Required variable CPACK_GENERATOR is not defined")
endif()
if(NOT CPACK_PACKAGE_CONTACT)
message(FATAL_ERROR "Required variable CPACK_PACKAGE_CONTACT is not defined")
endif()
@ -22,14 +18,3 @@ if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
message(FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined")
endif()
if(NOT CPACK_DEBIAN_PACKAGE_SECTION)
message(FATAL_ERROR "Required variable CPACK_DEBIAN_PACKAGE_SECTION is not defined")
endif()
if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
message(FATAL_ERROR "Required variable CPACK_DEBIAN_PACKAGE_PRIORITY is not defined")
endif()
if(NOT CPACK_SOURCE_IGNORE_FILES)
message(FATAL_ERROR "Required variable CPACK_SOURCE_IGNORE_FILES is not defined")
endif()