anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
CMakeLists.txt (1686B)
1 # Only do this if gettext is installed 2 if(GETTEXT_FOUND) 3 # Get all of the .po files 4 file(GLOB LANG_SRCS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.*.po") 5 sort_list(LANG_SRCS_PO) 6 7 foreach(LANG_PO ${LANG_SRCS_PO}) 8 # Get the domain for this language file 9 string(LENGTH ${LANG_PO} LANG_PO_LENGTH) 10 math(EXPR DOMAIN_LENGTH "${LANG_PO_LENGTH} - 9") 11 string(SUBSTRING ${LANG_PO} 0 ${DOMAIN_LENGTH} LANG_DOMAIN) 12 13 # Get the language for this language file 14 math(EXPR DOMAIN_LENGTH "${LANG_PO_LENGTH} - 8") 15 string(SUBSTRING ${LANG_PO} ${DOMAIN_LENGTH} 5 LANG_LANG) 16 17 # Get the .mo file name 18 string(REGEX REPLACE "\\.po$" ".mo" LANG_MO ${LANG_PO}) 19 # Add the .mo file to a list for use later with add_custom_target 20 set(LANG_SRCS_MO ${LANG_SRCS_MO} ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO}) 21 # Run msgfmt on the language file, depends on the .po file 22 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} 23 COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -c ${CMAKE_CURRENT_SOURCE_DIR}/${LANG_PO} -o ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} 24 MAIN_DEPENDENCY ${LANG_PO} 25 ) 26 # Add to cpack ignored files if not on Windows. 27 if(NOT WIN32) 28 add_to_cpack_ignored_files("${LANG_MO}") 29 endif(NOT WIN32) 30 31 # Install the new language file 32 install(CODE "FILE(MAKE_DIRECTORY ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES/)") 33 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS}) 34 endforeach(LANG_PO) 35 36 # Generate languages, depends on the mo files 37 add_custom_target(module_language DEPENDS ${LANG_SRCS_MO}) 38 endif(GETTEXT_FOUND)