Файл правил для uncrustify адаптируется к текущей версии программы

This commit is contained in:
Andrei Astafev 2021-12-22 10:33:24 +03:00
parent b8b5320b2a
commit 6a11f9b43d

View File

@ -18,15 +18,22 @@ function(myx_cmake_format_sources target)
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/.uncrustify.cfg)
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/.uncrustify.cfg)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/uncrustify.cfg
COMMAND ${UNCRUSTIFY_EXE} --update-config-with-doc
-c ${CMAKE_SOURCE_DIR}/.uncrustify.cfg
-o ${CMAKE_BINARY_DIR}/uncrustify.cfg)
list(APPEND UNCRUSTIFY_OPTS -L ERR -c ${CMAKE_BINARY_DIR}/uncrustify.cfg)
endif()
# cmake-format: off
add_custom_target(${target}-check-format-sources-uncrustify
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify.cfg
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --check ${__sources})
list(APPEND UNCRUSTIFY_OPTS --replace --no-backup)
add_custom_target(${target}-format-sources-uncrustify
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify.cfg
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --mtime ${__sources})
add_custom_target(${target}-add-doxygen-comments-uncrustify
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify.cfg
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}
--set cmt_insert_file_header=fileheader.txt
--set cmt_insert_file_footer=filefooter.txt