From bef76608367ee504581bf74dd794a135f66691d2 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 7 Jun 2021 17:46:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=B0=D0=B7=20=D0=BE=D1=82?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20Variables?= =?UTF-8?q?.cmake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCPack.cmake | 6 +++--- CMLibGlobalVariables.cmake | 8 ++++---- CMLibRequiredVariables.cmake | 26 ++++++++++++++------------ hpp/cmlib_private_config.hpp.in | 22 ++++++++++++++++++++-- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/CMLibCPack.cmake b/CMLibCPack.cmake index 0d2297c..01eeef1 100644 --- a/CMLibCPack.cmake +++ b/CMLibCPack.cmake @@ -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) diff --git a/CMLibGlobalVariables.cmake b/CMLibGlobalVariables.cmake index 5b9f60b..756a359 100644 --- a/CMLibGlobalVariables.cmake +++ b/CMLibGlobalVariables.cmake @@ -1,10 +1,10 @@ -if (NOT THEME_NAME) - set(THEME_NAME "default") +if (NOT CMLIB_THEME_NAME) + set(CMLIB_THEME_NAME "default") endif() -canonical_string(${ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL) +canonical_string(${CMLIB_ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL) canonical_string(${PROJECT_NAME} CMLIB_PROJECT_NAME_CANONICAL) -canonical_string(${THEME_NAME} CMLIB_THEME_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) diff --git a/CMLibRequiredVariables.cmake b/CMLibRequiredVariables.cmake index 4c4aa3d..0abcf24 100644 --- a/CMLibRequiredVariables.cmake +++ b/CMLibRequiredVariables.cmake @@ -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 "") diff --git a/hpp/cmlib_private_config.hpp.in b/hpp/cmlib_private_config.hpp.in index 7375f20..d5a3de6 100644 --- a/hpp/cmlib_private_config.hpp.in +++ b/hpp/cmlib_private_config.hpp.in @@ -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) @@ -45,7 +45,7 @@ #if defined (CMLIB_THEME_NAME) #error "Duplicate definition of macros CMLIB_THEME_NAME" #else -#define CMLIB_THEME_NAME "@THEME_NAME@" +#define CMLIB_THEME_NAME "@CMLIB_THEME_NAME@" #endif #if defined (CMLIB_THEME_NAME_LOWER) @@ -60,6 +60,24 @@ #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