diff --git a/lang/tomahawk_i18n.qrc b/lang/tomahawk_i18n.qrc new file mode 100644 index 000000000..a309b5d51 --- /dev/null +++ b/lang/tomahawk_i18n.qrc @@ -0,0 +1,5 @@ + + +tomahawk_de.qm + + diff --git a/lang/translations.cmake b/lang/translations.cmake new file mode 100644 index 000000000..a5b92f2f4 --- /dev/null +++ b/lang/translations.cmake @@ -0,0 +1,25 @@ +FILE (GLOB TS_FILES ${CMAKE_SOURCE_DIR}/lang/*.ts) +QT4_ADD_TRANSLATION(QM_FILES ${TS_FILES}) + +## HACK HACK HACK - around rcc limitations to allow out of source-tree building +SET( trans_file tomahawk_i18n ) +SET( trans_srcfile ${CMAKE_SOURCE_DIR}/lang/${trans_file}.qrc) +SET( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc) +SET( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${trans_file}.cxx) + +# Copy the QRC file to the output directory +ADD_CUSTOM_COMMAND( + OUTPUT ${trans_infile} + COMMAND ${CMAKE_COMMAND} -E copy ${trans_srcfile} ${trans_infile} + MAIN_DEPENDENCY ${trans_srcfile} +) + +# Run the resource compiler (rcc_options should already be set) +ADD_CUSTOM_COMMAND( + OUTPUT ${trans_outfile} + COMMAND ${QT_RCC_EXECUTABLE} + ARGS ${rcc_options} -name ${trans_file} -o ${trans_outfile} ${trans_infile} + MAIN_DEPENDENCY ${trans_infile} + DEPENDS ${QM_FILES} +) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 259756b05..69081156a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -186,7 +186,9 @@ qt4_wrap_cpp( tomahawkMoc ${tomahawkHeaders} ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) -SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} ) +include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake ) + +SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} ${trans_outfile}) IF( "${gui}" STREQUAL "no" ) ELSE()