myx-cmake/MyxCMake/modules/MyxCMakeGeneratePrivateConfigHeader.cmake

117 lines
3.8 KiB
CMake
Raw Permalink Normal View History

2022-05-06 09:49:46 +00:00
include_guard(GLOBAL)
function(myx_cmake_generate_private_config_header)
include(MyxCMakeLargeFiles)
myx_cmake_test_large_files(HAVE_LARGEFILES)
set(_filename ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_private_config_p.hpp)
2022-05-06 09:49:46 +00:00
if(MYX_CMAKE_GENERATED_HEADERS_PATH)
set(_filename ${MYX_CMAKE_GENERATED_HEADERS_PATH}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_private_config_p.hpp)
elseif(ARGV0)
set(_filename ${ARGV0})
endif()
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
set(_myx_cmake_private_config_hpp_in
"#ifndef @MYX_CMAKE_PROJECT_NAME_UPPER@_MYX_CMAKE_CONFIG_HPP_
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_MYX_CMAKE_CONFIG_HPP_
#pragma once
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_VERSION_STR \"@PROJECT_VERSION@\"
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_VERSION_INT @PROJECT_VERSION_INT@
#if defined (MYX_CMAKE_ORGANIZATION_NAME)
#error \"Duplicate definition of macros MYX_CMAKE_ORGANIZATION_NAME\"
#else
#define MYX_CMAKE_ORGANIZATION_NAME \"@MYX_CMAKE_ORGANIZATION_NAME@\"
#endif
#if defined (MYX_CMAKE_ORGANIZATION_NAME_LOWER)
#error \"Duplicate definition of macros MYX_CMAKE_ORGANIZATION_NAME_LOWER\"
#else
#define MYX_CMAKE_ORGANIZATION_NAME_LOWER \"@MYX_CMAKE_ORGANIZATION_NAME_LOWER@\"
#endif
#if defined (MYX_CMAKE_ORGANIZATION_NAME_UPPER)
#error \"Duplicate definition of macros MYX_CMAKE_ORGANIZATION_NAME_UPPER\"
#else
#define MYX_CMAKE_ORGANIZATION_NAME_UPPER \"@MYX_CMAKE_ORGANIZATION_NAME_UPPER@\"
#endif
#if defined (MYX_CMAKE_PROJECT_NAME)
#error \"Duplicate definition of macros MYX_CMAKE_PROJECT_NAME\"
#else
#define MYX_CMAKE_PROJECT_NAME \"@CMAKE_PROJECT_NAME@\"
#endif
#if defined (MYX_CMAKE_PROJECT_NAME_LOWER)
#error \"Duplicate definition of macros MYX_CMAKE_PROJECT_NAME_LOWER\"
#else
#define MYX_CMAKE_PROJECT_NAME_LOWER \"@MYX_CMAKE_PROJECT_NAME_LOWER@\"
#endif
#if defined (MYX_CMAKE_PROJECT_NAME_UPPER)
#error \"Duplicate definition of macros MYX_CMAKE_PROJECT_NAME_UPPER\"
#else
#define MYX_CMAKE_PROJECT_NAME_UPPER \"@MYX_CMAKE_PROJECT_NAME_UPPER@\"
#endif
#if defined (MYX_CMAKE_THEME_NAME)
#error \"Duplicate definition of macros MYX_CMAKE_THEME_NAME\"
#else
#define MYX_CMAKE_THEME_NAME \"@MYX_CMAKE_THEME_NAME@\"
#endif
#if defined (MYX_CMAKE_THEME_NAME_LOWER)
#error \"Duplicate definition of macros MYX_CMAKE_THEME_NAME_LOWER\"
#else
#define MYX_CMAKE_THEME_NAME_LOWER \"@MYX_CMAKE_THEME_NAME_LOWER@\"
#endif
#if defined (MYX_CMAKE_THEME_NAME_UPPER)
#error \"Duplicate definition of macros MYX_CMAKE_THEME_NAME_UPPER\"
#else
#define MYX_CMAKE_THEME_NAME_UPPER \"@MYX_CMAKE_THEME_NAME_UPPER@\"
#endif
#if defined (MYX_CMAKE_AUTHOR_NAME)
#error \"Duplicate definition of macros MYX_CMAKE_AUTHOR_NAME\"
#else
#define MYX_CMAKE_AUTHOR_NAME \"@MYX_CMAKE_AUTHOR_NAME@\"
#endif
#if defined (MYX_CMAKE_AUTHOR_EMAIL)
#error \"Duplicate definition of macros MYX_CMAKE_AUTHOR_EMAIL\"
#else
#define MYX_CMAKE_AUTHOR_EMAIL \"@MYX_CMAKE_AUTHOR_EMAIL@\"
#endif
#if defined (MYX_CMAKE_DESCRIPTION)
#error \"Duplicate definition of macros MYX_CMAKE_DESCRIPTION\"
#else
#define MYX_CMAKE_DESCRIPTION \"@MYX_CMAKE_DESCRIPTION@\"
#endif
#if defined (MYX_CMAKE_BUILD_TYPE)
#error \"Duplicate definition of macros MYX_CMAKE_BUILD_TYPE\"
#else
#define MYX_CMAKE_BUILD_TYPE \"@CMAKE_BUILD_TYPE@\"
#endif
#if defined (MYX_CMAKE_BUILD_DATE)
#error \"Duplicate definition of macros MYX_CMAKE_BUILD_DATE\"
#else
#define MYX_CMAKE_BUILD_DATE \"@TODAY@\"
#endif
#endif /* @MYX_CMAKE_PROJECT_NAME_UPPER@_MYX_CMAKE_CONFIG_HPP_ */
")
set(_myx_cmake_private_config_hpp_in_path ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/myx_cmake_private_config_p.hpp)
file(WRITE ${_myx_cmake_private_config_hpp_in_path} ${_myx_cmake_private_config_hpp_in})
configure_file(${_myx_cmake_private_config_hpp_in_path} ${_filename})
endfunction()