Отдельный файл настроек uncrustify.cfg для каждой цели

This commit is contained in:
Andrei Astafev 2021-12-29 12:50:56 +03:00
parent 530055de9d
commit a401afbe99

View File

@ -54,23 +54,23 @@ function(myx_cmake_format_sources target)
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/.uncrustify.cfg)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/uncrustify.cfg
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg
COMMAND ${UNCRUSTIFY_EXE} --update-config-with-doc
-c ${CMAKE_SOURCE_DIR}/.uncrustify.cfg
-o ${CMAKE_BINARY_DIR}/uncrustify.cfg)
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_BINARY_DIR}/uncrustify.cfg)
-o ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg)
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg)
endif()
# cmake-format: off
add_custom_target(${target}-format-sources-check-uncrustify
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify.cfg
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify-${target}.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
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} --mtime ${__sources})
add_custom_target(${target}-doc-doxygen-append-comments
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify.cfg
DEPENDS ${CMAKE_BINARY_DIR}/uncrustify-${target}.cfg
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS}
--set cmt_insert_class_header=uncrustify-classheader.txt
--set cmt_insert_file_footer=uncrustify-filefooter.txt