Warning, /sdk/pology/cmake/GettextTools.cmake is written in an unsupported language. File is not indexed.
0001 # TODO: Add doc comments for all this stuff. 0002 0003 if(NOT MSGFMT_EXECUTABLE) 0004 find_package(Msgfmt) 0005 endif() 0006 if(NOT MSGMERGE_EXECUTABLE) 0007 find_package(Msgmerge) 0008 endif() 0009 0010 if(NOT gtxt_target_count) 0011 set(gtxt_target_count 1) 0012 endif() 0013 0014 0015 macro(INSTALL_PO_DOMAIN podomain linguas localedir) 0016 0017 if(NOT MSGFMT_EXECUTABLE) 0018 message(FATAL_ERROR "MSGFMT_EXECUTABLE is not set.") 0019 endif() 0020 0021 set(alinguas ${linguas}) 0022 if(NOT IS_ABSOLUTE ${linguas}) 0023 set(alinguas ${CMAKE_CURRENT_SOURCE_DIR}/${linguas}) 0024 endif() 0025 if(NOT EXISTS ${alinguas}) 0026 message(FATAL_ERROR 0027 "The language list file '${alinguas}' is missing.") 0028 endif() 0029 file(READ ${alinguas} fc) 0030 string(REGEX REPLACE "#[^\n]*\n" " " fc ${fc}) 0031 string(REGEX MATCHALL "[^ \t\n]+" langs ${fc}) 0032 0033 string(REPLACE ${CMAKE_SOURCE_DIR}/ "" srcsubdir 0034 ${CMAKE_CURRENT_SOURCE_DIR}) 0035 string(REPLACE "/" "-" targbase ${srcsubdir}) 0036 set(target "${targbase}-gtxt${gtxt_target_count}-install-po-domain") 0037 math(EXPR gtxt_target_count "${gtxt_target_count} + 1") 0038 0039 set(mofiles) 0040 foreach(lang ${langs}) 0041 set(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po) 0042 if(NOT EXISTS ${pofile}) 0043 message(FATAL_ERROR 0044 "The PO file '${pofile}' expected according to '${alinguas}' " 0045 "is missing.") 0046 endif() 0047 set(mofile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) 0048 add_custom_command( 0049 OUTPUT ${mofile} 0050 COMMAND ${MSGFMT_EXECUTABLE} -c ${pofile} -o ${mofile} 0051 DEPENDS ${pofile} ${alinguas}) 0052 install(FILES ${mofile} DESTINATION ${localedir}/${lang}/LC_MESSAGES 0053 RENAME ${podomain}.mo) 0054 set(mofiles ${mofiles} ${mofile}) 0055 endforeach() 0056 add_custom_target(${target} ALL DEPENDS ${mofiles} ${alinguas}) 0057 0058 endmacro() 0059