From 178412c5052c43b6fbf1821a42244b92f6733f53 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Fri, 24 Dec 2021 14:44:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B5=D0=B2=20=D1=81=20=D0=BF=D0=BE=D0=BC?= =?UTF-8?q?=D0=BE=D1=89=D1=8C=D1=8E=20uncrustify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyxCMake/modules/MyxCMakeFormatSources.cmake | 59 +++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/MyxCMake/modules/MyxCMakeFormatSources.cmake b/MyxCMake/modules/MyxCMakeFormatSources.cmake index 42e278f..5498acf 100644 --- a/MyxCMake/modules/MyxCMakeFormatSources.cmake +++ b/MyxCMake/modules/MyxCMakeFormatSources.cmake @@ -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}