From 65246190b69815e4e622ab38247e8fb22ed91a7c Mon Sep 17 00:00:00 2001
From: samelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date: Thu, 21 Apr 2011 22:32:20 +0000
Subject: [applications/amarok] added cmake support for translations

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/amarok@1228680 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 CMakeLists.txt        |  7 ++++---
 ConfigureChecks.cmake |  7 +++++++
 po/CMakeLists.txt     | 17 +++++++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 po/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ff5907d..8feed576 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,7 +9,7 @@
 #
 #################################################
 
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required( VERSION 2.8 )
 
 
 ##### general package setup #####################
@@ -52,6 +52,7 @@ option( WITH_LIBGPOD "Enable iPod support from libgpod" OFF )
 
 option( BUILD_ALL "Build all" OFF )
 option( BUILD_DOC "Build doc" ${BUILD_ALL} )
+option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} )
 
 
 ##### configure checks ##########################
@@ -63,10 +64,9 @@ include( ConfigureChecks.cmake )
 
 add_definitions(
   -DHAVE_CONFIG_H
-  ${TQT_CFLAGS_OTHER}
 )
 
-set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include tqt.h" )
+set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
 set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
 set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
 
@@ -75,6 +75,7 @@ set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
 
 add_subdirectory( amarok )
 tde_conditional_add_subdirectory( BUILD_DOC doc )
+tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po )
 
 
 ##### write configure files #####################
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 43f66688..5c71a919 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -9,6 +9,13 @@
 #
 #################################################
 
+if( BUILD_TRANSLATIONS AND NOT DEFINED MSGFMT_EXECUTABLE )
+  find_program( MSGFMT_EXECUTABLE msgfmt )
+  if( NOT MSGFMT_EXECUTABLE )
+    tde_message_fatal( "msgfmt program is required, but was not found on your system" )
+  endif( )
+endif( )
+
 check_type_size( "int" SIZEOF_INT BUILTIN_TYPES_ONLY )
 check_type_size( "long" SIZEOF_LONG BUILTIN_TYPES_ONLY )
 
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 00000000..52b30c06
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,17 @@
+#################################################
+#
+#  (C) 2010-2011 Serghei Amelian
+#  serghei (DOT) amelian (AT) gmail.com
+#
+#  Improvements and feedback are welcome
+#
+#  This file is released under GPL >= 2
+#
+#################################################
+
+file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} amarok.po )
+
+foreach( _po ${po_files} )
+  get_filename_component( _lang ${_po} PATH )
+  tde_create_translation( FILES ${_po} LANG ${_lang} )
+endforeach( )
-- 
cgit v1.2.3

