poafloc

poafloc - Parser Of Arguments For Lines Of Commands
git clone git://git.dimitrijedobrota.com/poafloc.git
Log | Files | Refs | README | LICENSE

spell.cmake (657B)


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