CMake based app with translation files
-
Hi all. I have a cmake based project I am testing out translation files with.
I am using the following CMake code to compile and copy my .ts tranlsation files to my build folder in .qm form.
set(TRANSLATION_FILES translations/ui/translation-english.ts translations/ui/translation-french.ts ) set_source_files_properties(${TRANSLATION_FILES} PROPERTIES OUTPUT_LOCATION "translations/ui") qt5_add_translation(QM_FILES ${TRANSLATION_FILES}) ... add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS} ${QM_FILES})
This was strung together using the example code from here: https://doc.qt.io/qt-5/qtlinguist-cmake-qt5-add-translation.html) and works great when building from within Qt Creator and the files are placed here:
<app-exe-output-folder>/tranlsations/ui/
However, when building from within Visual Studio the build goes into a Release subfolder while my .qm translation files do not. So it looks something like this...
<output-folder>/tranlsations/ui/tranlsation-english.qm <output-folder>/tranlsations/ui/tranlsation-french.qm <output-folder>/Release/MyApp.exe
Is it possible for the Visual studio build to drop the qm files into the Release subfolder without breaking the Qt creator build?
I.e. the following structure instead:
<output-folder>/Release/tranlsations/ui/tranlsation-english.qm <output-folder>/Release/tranlsations/ui/tranlsation-french.qm <output-folder>/Release/MyApp.exe