Merge branch 'master' of git.246060.ru:f1x1t/cmlib

This commit is contained in:
Andrei Astafev 2021-06-12 13:00:04 +03:00
commit 9ff6a41c5a
6 changed files with 77 additions and 20 deletions

View File

@ -1,7 +1,7 @@
# Общие настройки для пакета: организация, автор, версия
set(CPACK_PACKAGE_VENDOR ${CMLIB_ORGANIZATION_NAME_LOWER})
set(CPACK_PACKAGE_NAME ${CMLIB_PROJECT_NAME_LOWER})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
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 "")
# Параметры для архива исходных текстов
if(NOT CPACK_SOURCE_GENERATOR)

View File

@ -5,6 +5,10 @@ if(CMAKE_INSTALL_PREFIX STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "Cannot install into build directory")
endif()
if(CMAKE_INSTALL_PREFIX STREQUAL PROJECT_SOURCE_DIR)
message(FATAL_ERROR "Cannot install into source directory")
endif()
include(CMLibDisableInSourceBuild)
include(CMakeParseArguments)
include(GNUInstallDirs)

View File

@ -1,11 +1,26 @@
if(NOT CMLIB_THEME_NAME)
set(CMLIB_THEME_NAME "default")
endif()
canonical_string(${CMLIB_ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL)
canonical_string(${PROJECT_NAME} CMLIB_PROJECT_NAME_CANONICAL)
canonical_string(${ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL)
canonical_string(${CMLIB_THEME_NAME} CMLIB_THEME_NAME_CANONICAL)
string(TOLOWER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_LOWER)
string(TOLOWER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_LOWER)
string(TOLOWER ${CMLIB_THEME_NAME_CANONICAL} CMLIB_THEME_NAME_LOWER)
string(TOUPPER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_UPPER)
string(TOUPPER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_UPPER)
string(TOUPPER ${CMLIB_THEME_NAME_CANONICAL} CMLIB_THEME_NAME_UPPER)
option(CMLIB_ADD_THEME_PREFIX "Append theme name to install prefix" OFF)
if(CMLIB_ADD_THEME_PREFIX AND NOT CMLIB_THEME_PREFIX_APPENDED)
if(NOT CMLIB_THEME_NAME_LOWER STREQUAL "default")
set(CMLIB_THEME_PREFIX_APPENDED ON CACHE BOOL "" FORCE)
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${CMLIB_THEME_NAME}" CACHE PATH "" FORCE)
endif()
endif()
# CMLIB_MODULE_DIR
foreach(module ${CMAKE_MODULE_PATH})

View File

@ -1,19 +1,21 @@
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/etc/Variables.cmake")
message(FATAL_ERROR "Required file cmake/etc/Variables.cmake does not exist")
#
# Обязательные переменные, значения которым необходимо присвоить в файле CMakeLists.txt
# до подключения CMLib, либо передать из командной строки через ключ -D
#
if(NOT CMLIB_ORGANIZATION_NAME)
message(FATAL_ERROR "Required variable CMLIB_ORGANIZATION_NAME is not defined")
endif()
include("${CMAKE_SOURCE_DIR}/cmake/etc/Variables.cmake")
if(NOT ORGANIZATION_NAME)
message(FATAL_ERROR "Required variable ORGANIZATION_NAME is not defined")
if(NOT CMLIB_AUTHOR_NAME)
message(FATAL_ERROR "Required variable CMLIB_AUTHOR_NAME is not defined")
endif()
set(CPACK_PACKAGE_VENDOR ${ORGANIZATION_NAME})
if(NOT CPACK_PACKAGE_CONTACT)
message(FATAL_ERROR "Required variable CPACK_PACKAGE_CONTACT is not defined")
if(NOT CMLIB_AUTHOR_EMAIL)
message(FATAL_ERROR "Required variable CMLIB_AUTHOR_EMAIL is not defined")
endif()
set(CPACK_PACKAGE_CONTACT "${CMLIB_AUTHOR_NAME} <${CMLIB_AUTHOR_EMAIL}>" CACHE STRING "")
if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
message(FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined")
if(NOT CMLIB_DESCRIPTION)
message(FATAL_ERROR "Required variable CMLIB_DESCRIPTION is not defined")
endif()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMLIB_DESCRIPTION} CACHE STRING "")

View File

@ -9,7 +9,7 @@
#if defined (CMLIB_ORGANIZATION_NAME)
#error "Duplicate definition of macros CMLIB_ORGANIZATION_NAME"
#else
#define CMLIB_ORGANIZATION_NAME "@ORGANIZATION_NAME@"
#define CMLIB_ORGANIZATION_NAME "@CMLIB_ORGANIZATION_NAME@"
#endif
#if defined (CMLIB_ORGANIZATION_NAME_LOWER)
@ -42,6 +42,42 @@
#define CMLIB_PROJECT_NAME_UPPER "@CMLIB_PROJECT_NAME_UPPER@"
#endif
#if defined (CMLIB_THEME_NAME)
#error "Duplicate definition of macros CMLIB_THEME_NAME"
#else
#define CMLIB_THEME_NAME "@CMLIB_THEME_NAME@"
#endif
#if defined (CMLIB_THEME_NAME_LOWER)
#error "Duplicate definition of macros CMLIB_THEME_NAME_LOWER"
#else
#define CMLIB_THEME_NAME_LOWER "@CMLIB_THEME_NAME_LOWER@"
#endif
#if defined (CMLIB_THEME_NAME_UPPER)
#error "Duplicate definition of macros CMLIB_THEME_NAME_UPPER"
#else
#define CMLIB_THEME_NAME_UPPER "@CMLIB_THEME_NAME_UPPER@"
#endif
#if defined (CMLIB_AUTHOR_NAME)
#error "Duplicate definition of macros CMLIB_AUTHOR_NAME"
#else
#define CMLIB_AUTHOR_NAME "@CMLIB_AUTHOR_NAME@"
#endif
#if defined (CMLIB_AUTHOR_EMAIL)
#error "Duplicate definition of macros CMLIB_AUTHOR_EMAIL"
#else
#define CMLIB_AUTHOR_EMAIL "@CMLIB_AUTHOR_EMAIL@"
#endif
#if defined (CMLIB_DESCRIPTION)
#error "Duplicate definition of macros CMLIB_DESCRIPTION"
#else
#define CMLIB_DESCRIPTION "@CMLIB_DESCRIPTION@"
#endif
#if defined (CMLIB_BUILD_TYPE)
#error "Duplicate definition of macros CMLIB_BUILD_TYPE"
#else