Talk:CMake:How To Build Qt4 Software
From KitwarePublic
Jump to navigationJump to search
Hi!
I'd like to tell my view on this topic. For a very large project this approach might be very good. But if we're talking about a smaller project with just a few steps to build I suggest to take a much easier way:
- when working you'd probably invoke QT-Linguist at some moment
- before that you might run lupdate by hand, as you also run linguist by hand
- then the .ts files already exist
- it won't be much fun if the already translated .ts files get lost (because you didn't read the warnings and issued make clean)
- also you'll probably have to take care of your language resources at some other point (qrc-file)
I guess this were enough reasons to not let CMake do it all alone (as CMake won't translate either ;)
I suggest the following way to go:
- define a variable containing all you ts-files
SET(LANG trans_en.ts trans_de.ts )
- further down your CMakeLists.txt add the translations
QT4_ADD_TRANSLATIONS(TRANSLATIONS ${LANG})
- finally don't forget to add them to your Target, else they won't be built
ADD_EXECUTABLE(exe_name ${sources} ${headers} ${resources} ${ui_s} ${moc_s} ${TRANSLATIONS})
So far I think it's a good way of not shooting with canons at birds ;) What do y'all think?
Cheers, St0fF