based

Opinionated utility library
git clone git://git.dimitrijedobrota.com/based.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

spell.cmake (657B)


0 cmake_minimum_required(VERSION 3.14)
2 macro(default name)
3 if(NOT DEFINED "${name}")
4 set("${name}" "${ARGN}")
5 endif()
6 endmacro()
8 default(SPELL_COMMAND codespell)
9 default(FIX NO)
11 set(flag "")
12 if(FIX)
13 set(flag -w)
14 endif()
16 execute_process(
17 COMMAND "${SPELL_COMMAND}" ${flag}
18 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
19 RESULT_VARIABLE result
20 )
22 if(result EQUAL "65")
23 message(FATAL_ERROR "Run again with FIX=YES to fix these errors.")
24 elseif(result EQUAL "64")
25 message(FATAL_ERROR "Spell checker printed the usage info. Bad arguments?")
26 elseif(NOT result EQUAL "0")
27 message(FATAL_ERROR "Spell checker returned with ${result}")
28 endif()