From 1bff4d2a0d6b1e762c1dd8eae37e4426cf62086a Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Fri, 19 Feb 2021 11:04:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibFormatSources.cmake | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CMLibFormatSources.cmake b/CMLibFormatSources.cmake index 6c4a3c0..daf5e09 100644 --- a/CMLibFormatSources.cmake +++ b/CMLibFormatSources.cmake @@ -4,20 +4,26 @@ function(add_format_sources target) if(NOT TARGET format-sources) add_custom_target(format-sources) endif() + if(NOT TARGET check-format-sources) + add_custom_target(check-format-sources) + endif() if(NOT TARGET doc-add-comments) add_custom_target(doc-add-comments) endif() find_program(UNCRUSTIFY_EXE NAMES uncrustify) if(UNCRUSTIFY_EXE) - list(APPEND UNCRUSTIFY_OPTS --replace --no-backup) if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg) list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg) endif() # cmake-format: off - add_custom_target(format-sources-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} - --mtime ${_sources}) - add_custom_target(doc-add-comments-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} + add_custom_target(check-format-sources-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE} + ${UNCRUSTIFY_OPTS} --check ${_sources}) + list(APPEND UNCRUSTIFY_OPTS --replace --no-backup) + add_custom_target(format-sources-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE} + ${UNCRUSTIFY_OPTS} --mtime ${_sources}) + add_custom_target(doc-add-comments-uncrustify-${target} COMMAND ${UNCRUSTIFY_EXE} + ${UNCRUSTIFY_OPTS} --set cmt_insert_file_header=fileheader.txt --set cmt_insert_file_footer=filefooter.txt --set cmt_insert_func_header=funcheader.txt @@ -25,6 +31,7 @@ function(add_format_sources target) --set cmt_insert_before_ctor_dtor=true ${_sources}) # cmake-format: on add_dependencies(format-sources format-sources-uncrustify-${target}) + add_dependencies(check-format-sources check-format-sources-uncrustify-${target}) add_dependencies(doc-add-comments doc-add-comments-uncrustify-${target}) else() message(STATUS "CMLIB warning:")