Radek Krejci | a198c96 | 2020-08-16 10:32:10 +0200 | [diff] [blame^] | 1 | # - Find uncrustify |
| 2 | # Find the uncrustify binary. |
| 3 | # |
| 4 | # UNCRUSTIFY - path ot the binary |
| 5 | # UNCRUSTIFY_VERSION - found version |
| 6 | # UNCRUSTIFY_FOUND - True if uncrustify found. |
| 7 | include(FindPackageHandleStandardArgs) |
| 8 | |
| 9 | find_program(UNCRUSTIFY uncrustify) |
| 10 | if(UNCRUSTIFY) |
| 11 | execute_process(COMMAND ${UNCRUSTIFY} --version OUTPUT_VARIABLE VERSION) |
| 12 | string(FIND ${VERSION} "-" START_IDX) |
| 13 | math(EXPR START_IDX "${START_IDX} + 1") |
| 14 | string(SUBSTRING "${VERSION}" ${START_IDX} -1 VERSION) |
| 15 | |
| 16 | string(FIND ${VERSION} "-" LEN) |
| 17 | string(SUBSTRING "${VERSION}" 0 ${LEN} UNCRUSTIFY_VERSION) |
| 18 | endif() |
| 19 | |
| 20 | # Handle the QUIETLY and REQUIRED arguments and set UNCRUSTIFY_FOUND to TRUE if all listed variables are TRUE. |
| 21 | find_package_handle_standard_args(Uncrustify REQUIRED_VARS UNCRUSTIFY VERSION_VAR UNCRUSTIFY_VERSION) |