Check_lang_size.cmake 493 B

123456789
  1. cmake_minimum_required(VERSION 3.18)
  2. FILE(SIZE ${LANG_FILE} FILE_SIZE)
  3. get_filename_component(FILE_BASE ${LANG_FILE} NAME)
  4. if(${FILE_SIZE} GREATER ${LANG_MAX_SIZE})
  5. message(FATAL_ERROR "Language file ${FILE_BASE} (${FILE_SIZE}b) exceeds maximum allowed size of ${LANG_MAX_SIZE} bytes - Aborting!")
  6. else()
  7. MATH(EXPR SIZE_PCT "( ${FILE_SIZE} * 100) / ${LANG_MAX_SIZE} " )
  8. message(STATUS "Language file ${FILE_BASE} is ${FILE_SIZE} bytes, ${SIZE_PCT}% of allowed space - OK")
  9. endif()