diff --git a/MyxCMake/modules/MyxCMakeFormatSources.cmake b/MyxCMake/modules/MyxCMakeFormatSources.cmake index 782e02a..0b83440 100644 --- a/MyxCMake/modules/MyxCMakeFormatSources.cmake +++ b/MyxCMake/modules/MyxCMakeFormatSources.cmake @@ -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