[CMake] CMake QT and QTLinguist
Clinton Stimpson
clinton at elemtech.com
Fri Oct 23 19:48:20 EDT 2009
On Thursday 22 October 2009 03:26:21 pm Andrew Maclean wrote:
> Has anyone used QTLinguist with CMake and if so how?
>
> Regards
> Andrew
Do you mean to create .ts and .qm files?
Here's an example of how to do it with cmake-gui.
# just insert the languages you want to support in this list
SET(LANGUAGES fr_FR)
SET(LANGUAGE_TS_FILES)
FOREACH(LANGUAGE ${LANGUAGES})
SET(TS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake_${LANGUAGE}.ts")
SET(LANGUAGE_TS_FILES ${LANGUAGE_TS_FILES} ${TS_FILE})
SET_SOURCE_FILES_PROPERTIES(${TS_FILE} PROPERTIES OUTPUT_LOCATION
"${CMake_BINARY_DIR}${CMAKE_DATA_DIR}/i18n")
ENDFOREACH(LANGUAGE ${LANGUAGES})
IF(LANGUAGE_TS_FILES)
QT4_CREATE_TRANSLATION(qm_files ${SRCS} ${LANGUAGE_TS_FILES})
ENDIF(LANGUAGE_TS_FILES)
ADD_EXECUTABLE(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${qm_files})
The .ts files are updated in the source directory, so the translations can be
saved. Then the person translating can run the Qt linguist on those .ts files.
But there is also the QT4_ADD_TRANSLATION to do the .qm files for you if you
want to do the .ts files manually near release time.
Clint
More information about the CMake
mailing list