2022-10-03 12:06:53 +00:00
|
|
|
|
#[=======================================================================[.rst:
|
|
|
|
|
myx_generate_private_config_header
|
|
|
|
|
----------------------------------
|
|
|
|
|
|
|
|
|
|
Вспомогательная функция для автоматической генерации заголовочного
|
|
|
|
|
файла, содержащего информацию о проекте::
|
|
|
|
|
|
|
|
|
|
myx_generate_private_config_header(TARGET BASE_FILENAME)
|
|
|
|
|
|
|
|
|
|
Обязательные параметры: `TARGET` - имя цели, с которой связан заголовочный файл,
|
|
|
|
|
и `BASE_FILENAME` - имя генерируемого заголовочного файла.
|
|
|
|
|
|
|
|
|
|
#]=======================================================================]
|
|
|
|
|
|
|
|
|
|
include_guard(GLOBAL)
|
|
|
|
|
|
2022-10-06 08:10:43 +00:00
|
|
|
|
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
|
|
|
|
set(MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}")
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-10-03 12:06:53 +00:00
|
|
|
|
function(myx_generate_private_config_header target base_filename)
|
2022-10-06 08:10:43 +00:00
|
|
|
|
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
|
|
|
|
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT})
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-10-03 12:06:53 +00:00
|
|
|
|
set(BUILD_DATE ${MYX_TODAY})
|
|
|
|
|
myx_project_version_int()
|
|
|
|
|
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
|
|
|
|
|
|
|
|
|
set(filename "${PROJECT_BINARY_DIR}/include/${base_filename}")
|
2022-10-06 08:10:43 +00:00
|
|
|
|
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PrivateConfig.hpp.in" ${filename})
|
2022-10-03 12:06:53 +00:00
|
|
|
|
|
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY PRIVATE_HEADER_FILES ${filename})
|
|
|
|
|
target_sources(${target} PRIVATE ${filename})
|
|
|
|
|
endfunction()
|