<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/117560/">https://git.reviewboard.kde.org/r/117560/</a>
     </td>
    </tr>
   </table>
   <br />




<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Build System, Extra Cmake Modules and KDE Frameworks.</div>
<div>By Aurélien Gâteau.</div>


<p style="color: grey;"><i>Updated April 15, 2014, 5:36 p.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Support KDE Frameworks 5.0beta1 syntax.</pre>
  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
extra-cmake-modules
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Translators (are going to) translate KF5 in trunk/l10n-kf5 ( http://websvn.kde.org/trunk/l10n-kf5/ ). It is necessary to support their work-flow, which consists of:
1) build the code from git
2) builds and installs all translations from one language

The patch makes several changes to ECMCreateQmFromPoFiles to support this work-flow:

- It splits the code into two functions: one to create the .qm and install them, another to build the .qm loader. This way the loader can be generated even if no translations are available.

- It changes the syntax of ecm_create_qm_from_po_files() to accept po files instead of a po directory. This is needed because within the same language directory some .po are going to be turned into .qm while others are turned into .mo.

- It creates "translation-N" targets (like CMake gettext code does) to support multiple calls within one cmake project.

- It installs to share/locale/<lang>/LC_MESSAGES (like gettext), because l10n-kf5 build system cannot know where the framework would decide to keep its .qm file, so it's simpler to use a standard place.

This potentially breaks existing framework builds, but only for developers who created manually po/ directories in their work tree (almost nobody, I expect), so I think it can be pushed as is. I already have the code ready to fix existing frameworks.

Those changes still support shipping translations within frameworks tarballs. Assuming this patch gets in, the build system of each framework is going to be patched like this:

-----------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5e445c..c9a706c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,8 @@ include(GenerateExportHeader)
 include(ECMSetupVersion)
 include(ECMGenerateHeaders)
 
+include(ECMCreateQmFromPoFiles)
+
 set(KF5_VERSION "4.98.0")
 
 ecm_setup_version(${KF5_VERSION}
@@ -37,14 +39,9 @@ if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
   find_package(KF5XmlGui ${KF5_VERSION} REQUIRED)
 endif()
 
-if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/po)
-  include(ECMCreateQmFromPoFiles)
-  ecm_create_qm_from_po_files(
-    PO_DIR po
-    POT_NAME kbookmarks5.pot
-    DATA_INSTALL_SUB_DIR kbookmarks
-    CREATE_LOADER kbookmarks_QM_LOADER
-  )
+file(GLOB PO_FILES "po/*.po")
+if (PO_FILES)
+  ecm_create_qm_from_po_files(PO_FILES ${PO_FILES} CATALOG_NAME kbookmarks5)
 endif()
 
 add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 676b172..faa25e1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,8 @@
 # TODO
 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
 
+ecm_create_qm_loader(kbookmarks_QM_LOADER kbookmarks5)
+
 set(kbookmarks_SRCS
   kbookmark.cpp
   kbookmarkaction.cpp
-----------------------------------------------------</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Built translations for KF5 from within frameworks source and from a patched l10n-kf5.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>modules/ECMCreateQmFromPoFiles.cmake <span style="color: grey">(92d0d1a)</span></li>

 <li>modules/ECMQmLoader.cpp.in <span style="color: grey">(4fd9c11)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/117560/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>




  </div>
 </body>
</html>