OSDN Git Service

[BUILD][CMAKE] Scripts moved to under source/cmake/ .
[csp-qt/common_source_project-fm7.git] / source / cmake / compile_gettext_catalogue.cmake
1 ##
2 ## Compile Gettext's I18N catalogue (foo.po to out.mo)
3 ##  And install to dest.
4 ##  (C) 2014 K.Ohta <whatisthis.sowhat@gmail.com>
5 ## requires find_package(Gettext) befor define this.
6 ## License: Apache 2
7 ##
8 cmake_minimum_required (VERSION 2.6)
9
10 function(compile_i18n_po_to_mo in target)
11   if(GETTEXT_FOUND)
12      add_custom_target(${target} ALL 
13                      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${in}
14                      COMMAND  ${GETTEXT_MSGFMT_EXECUTABLE}
15                               ${CMAKE_CURRENT_SOURCE_DIR}/${in}
16                               -o ${CMAKE_CURRENT_BINARY_DIR}/messages.mo
17                      )
18    endif()
19 endfunction(compile_i18n_po_to_mo)
20
21
22 function(install_i18n_catalogue in dest)
23     if(GETTEXT_FOUND)
24       install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${in}
25                     ${CMAKE_CURRENT_BINARY_DIR}/messages.mo
26              DESTINATION ${dest}/LC_MESSAGES)
27     endif()
28 endfunction(install_i18n_catalogue)
29