package-rebuilds/pkgs/libyang/libyang-3.7.8/CMakeModules/FindUncrustify.cmake
Thomas Lamprecht 853454b646 libyang: check in 3.7.8 source
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-03-07 14:34:15 +01:00

22 lines
848 B
CMake

# - 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)