From 02ed5338ed1f7cbbd4a1d5d3d49a02ab01ea9273 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 2 Dec 2014 16:02:19 +0100 Subject: [PATCH] Handle translations when building with CMake. --- CMakeLists.txt | 4 +++- gtk/CMakeLists.txt | 4 ++++ po/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 po/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index ac04dc879..85a86bf42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ if(ENABLE_NOTIFY) set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE) endif() endif() +find_package(Gettext) include_directories( @@ -114,7 +115,7 @@ if(MSVC) include_directories(${CMAKE_PREFIX_PATH}/include/MSVC) endif() -add_definitions(-DIN_LINPHONE) +add_definitions("-DIN_LINPHONE") if(MSVC) @@ -163,6 +164,7 @@ add_subdirectory(share) if(ENABLE_GTK_UI) add_subdirectory(gtk) add_subdirectory(pixmaps) + add_subdirectory(po) endif() if(ENABLE_TOOLS) add_subdirectory(tools) diff --git a/gtk/CMakeLists.txt b/gtk/CMakeLists.txt index e5d66561b..89d5805a6 100644 --- a/gtk/CMakeLists.txt +++ b/gtk/CMakeLists.txt @@ -65,6 +65,10 @@ set(SOURCE_FILES videowindow.c ) +if(GETTEXT_FOUND) + add_definitions("-DENABLE_NLS") +endif() + add_executable(linphone-gtk ${SOURCE_FILES}) set_target_properties(linphone-gtk PROPERTIES OUTPUT_NAME linphone) target_include_directories(linphone-gtk PUBLIC ${GTK2_INCLUDE_DIRS}) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 000000000..7c39caac6 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,33 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################ + +if(GETTEXT_FOUND) + string(REPLACE " " ";" LANGUAGES ${LINPHONE_ALL_LANGS}) + foreach(language ${LANGUAGES}) + GETTEXT_PROCESS_PO_FILES(${language} ALL PO_FILES ${language}.po) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${language}.gmo + DESTINATION ${PACKAGE_LOCALE_DIR}/${language}/LC_MESSAGES + RENAME linphone.mo + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + ) + endforeach() +endif()