Исправлено добавление комментариев с помощью uncrustify

This commit is contained in:
Andrei Astafev 2021-12-24 14:44:34 +03:00
parent 5e4a5155ca
commit 178412c505

View File

@ -1,6 +1,42 @@
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
if(UNCRUSTIFY_EXE)
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-classheader.txt)
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-classheader.txt CONTENT
"/**
* @class $(fclass)
* @brief TODO
* @details TODO
*/")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-filefooter.txt)
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-filefooter.txt CONTENT
"// EOF $(filename)")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-fileheader.txt)
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-fileheader.txt CONTENT
"/**
* @file $(filename)
* @brief TODO
* @details TODO
*/")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/uncrustify-funcheader.txt)
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-funcheader.txt CONTENT
"/**
* @fn $(fclass)::$(function)
* $(javaparam)
* @details TODO
*/")
endif()
endif()
function(myx_cmake_format_sources target)
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
if(UNCRUSTIFY_EXE)
get_target_property(__sources ${target} SOURCES)
list(FILTER __sources EXCLUDE REGEX "qrc_.*\\.cpp$")
@ -32,26 +68,7 @@ function(myx_cmake_format_sources target)
add_custom_target(${target}-format-sources-uncrustify
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify.cfg
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --mtime ${__sources})
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-classheader.txt CONTENT
"/**
* @class $(fclass)
* @brief TODO
* @details TODO
*/")
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-filefooter.txt CONTENT
"// EOF $(filename)")
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-fileheader.txt CONTENT
"/**
* @file $(filename)
* @brief TODO
* @details TODO
*/")
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-funcheader.txt CONTENT
"/**
* @fn $(fclass)::$(function)
* $(javaparam)
* @details TODO
*/")
add_custom_target(${target}-doc-doxygen-append-comments
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify.cfg
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}