From cd07912073c951b4bbb871ed2653af1be2cfc714 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:55:11 +0200 Subject: Adding upstream version 2.1.30. Signed-off-by: Daniel Baumann --- CMakeModules/FindUncrustify.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 CMakeModules/FindUncrustify.cmake (limited to 'CMakeModules/FindUncrustify.cmake') diff --git a/CMakeModules/FindUncrustify.cmake b/CMakeModules/FindUncrustify.cmake new file mode 100644 index 0000000..3b013e8 --- /dev/null +++ b/CMakeModules/FindUncrustify.cmake @@ -0,0 +1,21 @@ +# - Find uncrustify +# Find the uncrustify binary. +# +# UNCRUSTIFY - path ot the binary +# UNCRUSTIFY_VERSION - found version +# UNCRUSTIFY_FOUND - True if uncrustify found. +include(FindPackageHandleStandardArgs) + +find_program(UNCRUSTIFY uncrustify) +if(UNCRUSTIFY) + execute_process(COMMAND ${UNCRUSTIFY} --version OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE VERSION) + string(FIND ${VERSION} "-" START_IDX) + math(EXPR START_IDX "${START_IDX} + 1") + string(SUBSTRING "${VERSION}" ${START_IDX} -1 VERSION) + + string(FIND ${VERSION} "-" LEN) + string(SUBSTRING "${VERSION}" 0 ${LEN} UNCRUSTIFY_VERSION) +endif() + +# Handle the QUIETLY and REQUIRED arguments and set UNCRUSTIFY_FOUND to TRUE if all listed variables are TRUE. +find_package_handle_standard_args(Uncrustify REQUIRED_VARS UNCRUSTIFY VERSION_VAR UNCRUSTIFY_VERSION) -- cgit v1.2.3