[CMake] qt4_cmake_ts

Bráulio Oliveira brauliobo at gmail.com
Wed May 2 16:22:06 EDT 2007


Hello,

I saw Patrick's message at cmake mailing list (
http://public.kitware.com/pipermail/cmake/2006-July/010055.html) searching
for somethings that take cares of qt3 .ts translations files. His code
didn't work, but it because of a single line: MAIN_DEPENDENCY
translations/${prefix}-${lang}.ts ! I modified it a bit and transcribed it
here:

MACRO (QT4_WRAP_TS lupdate_outputs lrelease_outputs prefix)
    set(QT_LUPDATE_EXECUTABLE lupdate)
    set(QT_LRELEASE_EXECUTABLE lrelease)
    FOREACH (lang ${ARGN})
#        create/update .ts file
        SET(tsfile translations/${prefix}-${lang}.ts)
        ADD_CUSTOM_COMMAND(OUTPUT ${tsfile}
            COMMAND ${QT_LUPDATE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} -ts
${tsfile}
        )

#        create .qm file
        SET(qmfile translations/${prefix}-${lang}.qm)
        ADD_CUSTOM_COMMAND(OUTPUT ${qmfile}
            COMMAND ${QT_LRELEASE_EXECUTABLE} ${tsfile} -qm ${qmfile}
            MAIN_DEPENDENCY translations/${prefix}-${lang}.ts
        )

#        append to the list of translations
        SET(${lupdate_outputs} ${${lupdate_outputs}} ${tsfile})
        SET(${lrelease_outputs} ${${lrelease_outputs}} ${qmfile})
    ENDFOREACH(lang)
ENDMACRO (QT4_WRAP_TS)

After this you run it, as the example below:

qt4_wrap_ts(foo_TS foo_QM foo
    pt_BR
)

Then you add a target/executable that depends on foo_QM and it will generate
the wanted .qm files.
I'm posting this here because I think FindQt4.cmake should already had this
macro. As you can see, it could be easily adapted for it. Hope this get
merged


Best Regards,
Bráulio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070502/95dbd491/attachment.html


More information about the CMake mailing list