neovim/cmake/ConvertPo.cmake
dundargoc 1086016477
build: cmake cleanup
- Simplify error checking when using execute_process.
- Set BUILD_SHARED_LIBS to OFF when building dependencies.
  This is normally not needed, but msgpack interprets an unset
  BUILD_SHARED_LIBS to build a shared library, which is the opposite of
  the cmake behavior.
- Move function check_lua_module to Util.cmake.
- Remove unnecessary code.
- Make variable naming more consistent
2023-05-13 12:12:29 +02:00

22 lines
701 B
CMake

string(TOUPPER ${INPUT_ENC} upperInputEnc)
string(TOLOWER ${INPUT_ENC} lowerInputEnc)
get_filename_component(inputName ${INPUT_FILE} NAME)
execute_process(
COMMAND ${ICONV_PRG} -f ${INPUT_ENC} -t ${OUTPUT_ENC} ${INPUT_FILE}
OUTPUT_VARIABLE trans
ERROR_VARIABLE err
RESULT_VARIABLE res)
if(res)
message(FATAL_ERROR "iconv failed to run correctly: ${err}")
endif()
string(REPLACE "charset=${lowerInputEnc}" "charset=${OUTPUT_CHARSET}"
trans "${trans}")
string(REPLACE "charset=${upperInputEnc}" "charset=${OUTPUT_CHARSET}"
trans "${trans}")
string(REPLACE "# Original translations"
"# Generated from ${inputName}, DO NOT EDIT"
trans "${trans}")
file(WRITE ${OUTPUT_FILE} "${trans}")