From 7302444663473d362faca566fdb2e6fcfae627ab Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Wed, 13 Feb 2019 12:55:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B3=D0=BB=D0=BE=D0=B1=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCommon.cmake | 1 + CMLibCompilerFeaturesHPPGenerate.cmake | 3 +-- CMLibConfigHPPGenerate.cmake | 1 - CMLibGlobalVariables.cmake | 5 +++++ hpp/config.hpp.in | 11 ++++++----- 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 CMLibGlobalVariables.cmake diff --git a/CMLibCommon.cmake b/CMLibCommon.cmake index da3bd50..3ec917a 100644 --- a/CMLibCommon.cmake +++ b/CMLibCommon.cmake @@ -19,6 +19,7 @@ set_project_version() include(CMLibOrganizationName) set_organization_name() +include(CMLibGlobalVariables) include(CMLibInstallInOpt) include(CMLibLSBInfo) include(CMLibCompiler) diff --git a/CMLibCompilerFeaturesHPPGenerate.cmake b/CMLibCompilerFeaturesHPPGenerate.cmake index 3dfa8a1..d88fd1a 100644 --- a/CMLibCompilerFeaturesHPPGenerate.cmake +++ b/CMLibCompilerFeaturesHPPGenerate.cmake @@ -1,9 +1,8 @@ include(WriteCompilerDetectionHeader) -string(TOUPPER ${PROJECT_NAME} _project_name_uppercase) write_compiler_detection_header( FILE include/compiler_features.hpp - PREFIX ${_project_name_uppercase} + PREFIX ${CMLIB_PROJECT_NAME_CANONICAL} COMPILERS GNU Clang MSVC Intel FEATURES cxx_nullptr diff --git a/CMLibConfigHPPGenerate.cmake b/CMLibConfigHPPGenerate.cmake index dc9c7e6..34f536c 100644 --- a/CMLibConfigHPPGenerate.cmake +++ b/CMLibConfigHPPGenerate.cmake @@ -2,6 +2,5 @@ function(cmlib_config_hpp_generate) get_property(VERSION_INT GLOBAL PROPERTY VERSION_INT) get_property(VERSION_STR GLOBAL PROPERTY VERSION_STR) 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) endfunction() diff --git a/CMLibGlobalVariables.cmake b/CMLibGlobalVariables.cmake new file mode 100644 index 0000000..22dc80c --- /dev/null +++ b/CMLibGlobalVariables.cmake @@ -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}) + diff --git a/hpp/config.hpp.in b/hpp/config.hpp.in index 7b80b5e..2df7009 100644 --- a/hpp/config.hpp.in +++ b/hpp/config.hpp.in @@ -1,8 +1,8 @@ -#ifndef @PROJECT_NAME_UPPERCASE@_CONFIG_HPP_ -#define @PROJECT_NAME_UPPERCASE@_CONFIG_HPP_ +#ifndef @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_HPP_ +#define @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_HPP_ -#define @PROJECT_NAME_UPPERCASE@_VERSION_STR "@VERSION_STR@" -#define @PROJECT_NAME_UPPERCASE@_VERSION_INT @VERSION_INT@ +#define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_STR "@VERSION_STR@" +#define @CMLIB_PROJECT_NAME_CANONICAL@_VERSION_INT @VERSION_INT@ #define ORGANIZATION_NAME "@ORGANIZATION_NAME@" #define PROJECT_NAME "@CMAKE_PROJECT_NAME@" #define BUILD_TYPE "@CMAKE_BUILD_TYPE@" @@ -12,4 +12,5 @@ #cmakedefine RELEASE @RELEASE@ #cmakedefine ANALYSIS @ANALYSIS@ -#endif // @PROJECT_NAME_UPPERCASE@_CONFIG_HPP_ +#endif /* @CMLIB_PROJECT_NAME_CANONICAL@_CONFIG_HPP_ */ +