diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2016-05-31 12:20:37 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2016-05-31 12:20:37 +0300 |
commit | 67a38b06132bf1b875ca0ab53b5477cce046da2e (patch) | |
tree | d19e905131a044fc5e61dac445faf28c8dc37ebb /cmake | |
parent | 5e293812e596735107774cb568625a55ee2a3175 (diff) |
Manually merged gettext PR #178 by @hasufell
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/GETTEXT.cmake | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cmake/GETTEXT.cmake b/cmake/GETTEXT.cmake index e3056f8cd..1cf000175 100644 --- a/cmake/GETTEXT.cmake +++ b/cmake/GETTEXT.cmake @@ -14,17 +14,27 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. find_suggested_package(Gettext) + function(gettext po_dir package_name) + # check if LINGUAS env var is unset + execute_process(COMMAND sh -c "echo -n \${LINGUAS+x}" + OUTPUT_VARIABLE UNSETLINGUAS) set(mo_files) file(GLOB po_files ${po_dir}/*.po) foreach(po_file ${po_files}) get_filename_component(lang ${po_file} NAME_WE) set(mo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) + if($ENV{LINGUAS} MATCHES "^.*${lang}.*$" OR "${UNSETLINGUAS}" STREQUAL "") + set(mo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) + add_custom_command(OUTPUT ${mo_file} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file} DEPENDS ${po_file}) + install(FILES ${mo_file} DESTINATION share/locale/${lang}/LC_MESSAGES RENAME ${package_name}.mo) + set(mo_files ${mo_files} ${mo_file}) + endif() add_custom_command(OUTPUT ${mo_file} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file} DEPENDS ${po_file}) install(FILES ${mo_file} DESTINATION share/locale/${lang}/LC_MESSAGES RENAME ${package_name}.mo) set(mo_files ${mo_files} ${mo_file}) |