neovim/cmake/CheckUncrustifyVersion.cmake
dundargoc e12035fc0c
build(lint): check uncrustify version #19468
This to prevent the user from accidentally using the wrong uncrustify
version.
2022-07-25 06:18:49 -07:00

14 lines
536 B
CMake

if(UNCRUSTIFY_PRG)
execute_process(COMMAND uncrustify --version
OUTPUT_VARIABLE user_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "[A-Za-z_#-]" "" user_version ${user_version})
file(STRINGS ${CONFIG_FILE} required_version LIMIT_COUNT 1)
string(REGEX REPLACE "[A-Za-z_# -]" "" required_version ${required_version})
if(NOT user_version STREQUAL required_version)
message(FATAL_ERROR "Wrong uncrustify version! Required version is ${required_version} but found ${user_version}")
endif()
endif()