Отдельный файл для глобальных переменных

This commit is contained in:
Andrei Astafev 2019-02-13 12:55:42 +03:00
parent b083a6cc0f
commit 7302444663
5 changed files with 13 additions and 8 deletions

View File

@ -19,6 +19,7 @@ set_project_version()
include(CMLibOrganizationName) include(CMLibOrganizationName)
set_organization_name() set_organization_name()
include(CMLibGlobalVariables)
include(CMLibInstallInOpt) include(CMLibInstallInOpt)
include(CMLibLSBInfo) include(CMLibLSBInfo)
include(CMLibCompiler) include(CMLibCompiler)

View File

@ -1,9 +1,8 @@
include(WriteCompilerDetectionHeader) include(WriteCompilerDetectionHeader)
string(TOUPPER ${PROJECT_NAME} _project_name_uppercase)
write_compiler_detection_header( write_compiler_detection_header(
FILE include/compiler_features.hpp FILE include/compiler_features.hpp
PREFIX ${_project_name_uppercase} PREFIX ${CMLIB_PROJECT_NAME_CANONICAL}
COMPILERS GNU Clang MSVC Intel COMPILERS GNU Clang MSVC Intel
FEATURES FEATURES
cxx_nullptr cxx_nullptr

View File

@ -2,6 +2,5 @@ function(cmlib_config_hpp_generate)
get_property(VERSION_INT GLOBAL PROPERTY VERSION_INT) get_property(VERSION_INT GLOBAL PROPERTY VERSION_INT)
get_property(VERSION_STR GLOBAL PROPERTY VERSION_STR) get_property(VERSION_STR GLOBAL PROPERTY VERSION_STR)
get_property(ORGANIZATION_NAME GLOBAL PROPERTY ORGANIZATION_NAME) get_property(ORGANIZATION_NAME GLOBAL PROPERTY ORGANIZATION_NAME)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)
configure_file(${CMAKE_SOURCE_DIR}/cmake/cmlib/hpp/config.hpp.in ${CMAKE_BINARY_DIR}/include/config.hpp) configure_file(${CMAKE_SOURCE_DIR}/cmake/cmlib/hpp/config.hpp.in ${CMAKE_BINARY_DIR}/include/config.hpp)
endfunction() endfunction()

View File

@ -0,0 +1,5 @@
# CMLIB_PROJECT_NAME_CANONICAL
string(TOUPPER ${PROJECT_NAME} _project_name_uppercase)
string(REGEX REPLACE "[ -]" "_" _project_name_fixed ${_project_name_uppercase})
set(CMLIB_PROJECT_NAME_CANONICAL ${_project_name_fixed})

View File

@ -1,8 +1,8 @@
#ifndef @PROJECT_NAME_UPPERCASE@_CONFIG_HPP_ #ifndef @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_HPP_
#define @PROJECT_NAME_UPPERCASE@_CONFIG_HPP_ #define @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_HPP_
#define @PROJECT_NAME_UPPERCASE@_VERSION_STR "@VERSION_STR@" #define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_STR "@VERSION_STR@"
#define @PROJECT_NAME_UPPERCASE@_VERSION_INT @VERSION_INT@ #define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_INT @VERSION_INT@
#define ORGANIZATION_NAME "@ORGANIZATION_NAME@" #define ORGANIZATION_NAME "@ORGANIZATION_NAME@"
#define PROJECT_NAME "@CMAKE_PROJECT_NAME@" #define PROJECT_NAME "@CMAKE_PROJECT_NAME@"
#define BUILD_TYPE "@CMAKE_BUILD_TYPE@" #define BUILD_TYPE "@CMAKE_BUILD_TYPE@"
@ -12,4 +12,5 @@
#cmakedefine RELEASE @RELEASE@ #cmakedefine RELEASE @RELEASE@
#cmakedefine ANALYSIS @ANALYSIS@ #cmakedefine ANALYSIS @ANALYSIS@
#endif // @PROJECT_NAME_UPPERCASE@_CONFIG_HPP_ #endif /* @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_HPP_ */