[CMake] Re: Question about qt4_cmake_ts

Bráulio Oliveira brauliobo at gmail.com
Thu May 31 14:42:05 EDT 2007


Hi Klaus,

I don't remember exactly, but the qt4_wrap_ts has some bugs. You may try
'make lupdate' with that code. The reason because it doesn't work is that
.ts doesn't depend on source codes, so .ts doesn't update when sources
changes. In fact, it is not important to update .ts every time a source
change, but only when you're about to release a version. That is the time
translators should start to work.
I've made a modified version of that code which work in a different way. See
the thread
http://article.gmane.org/gmane.comp.programming.tools.cmake.user/6297 . An
example of it can be seen on my project's CMakeLists.txt at
http://lablux.svn.sourceforge.net/viewvc/lablux/trunk/src/CMakeLists.txt?view=markup
I asked for inclusion on Qt4 module, but anyone showed interest.

Cheers,
bráulio

the code:

  # QT4_WRAP_TS(outfiles infiles ...)
  # outfiles receives .qm generated files from
  # .ts files in arguments
  # a target lupdate is created for you
  # update/generate your translations files
  # example: QT4_WRAP_TS(foo_QM ${foo_TS})

  MACRO (QT4_WRAP_TS outfiles)
    # a target to manually run lupdate
    ADD_CUSTOM_TARGET(lupdate
                      COMMAND ${QT_LUPDATE_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR} -ts ${ARGN}
                      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                     )

    FOREACH (it ${ARGN})
      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}.qm)
      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
                         COMMAND ${QT_LRELEASE_EXECUTABLE}
                         ARGS ${it} -qm ${outfile}
                         DEPENDS ${it}
                        )

      SET(${outfiles} ${${outfiles}} ${outfile})
    ENDFOREACH (it)
  ENDMACRO (QT4_WRAP_TS)

On 5/31/07, Klaus Weidenbach <klaus.weidenbach at googlemail.com> wrote:
>
> Hello,
>
> I found your script at:
> http://www.cmake.org/pipermail/cmake/2007-May/013833.html and it is
> exactly what I was looking for. It also seems to work so far fine, but
> I have one problem and would like to know if I made something wrong or
> if you have the same problem. For me it is not possible to update an
> existing .ts file. So when I edit the sourcecode and add or remove
> strings these changes will never make it into the .ts files. If I run
> lupdate by hand on the command line they get updated. Creating the .ts
> files when they don't exist works fine.
>
> Thank you very much!
>
> --
> xo,klaus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070531/0fe05d8e/attachment.html


More information about the CMake mailing list