File: FindUncrustify.cmake

package info (click to toggle)
libnetconf2 3.7.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,200 kB
  • sloc: ansic: 33,538; sh: 49; makefile: 21
file content (21 lines) | stat: -rw-r--r-- 848 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)