View Full Version : Qt5 with CMake: how to find qt translations dir?

9th July 2014, 23:17
I am currently working on porting my application to Qt5. I use CMake as my build system. With Qt4, I used QT_TRANSLATIONS_DIR variable to copy precompiled Qt translations to the target directory. However, Qt5 does not define any of these specific variables. I know the command


gives me correct path to where Qt translations are installed on my system. I would like to use it, but now I dont know how to get the qmake executable path. I tried to use


variable, but it gives me "Qt5::qmake", which is not a correct executable.

What I would like to see is a list of Qt each target's properties to know how I can get specific variables, but I could not find anything like that on the internet. CMake documentation does not answer my questions.

How can I get path of qt translations with cmake and qt5? Thank you in advance for your answer.

10th July 2014, 03:01
Why don't you simply create an environment variable that points to the location of qmake? Doesn't the visual CMake utility let you resolve build-time variables like this?

10th July 2014, 09:54
It does, but it is not a solution and I want a solution, not a workaround. One should be able to build my project without setting any additional evironment variables.
I do not understand why qmake executable can't be found somewhere in CMake. Qt documentation specifies how to merge specific translations using lconvert, but it does not tell how to find them.

11th July 2014, 19:09
If CMake can't find the qmake executable, it is a problem with your environment's PATH setting. The failure to build your conversions is an irrelevant side effect. If CMake can't find an executable, it won't be able to build whatever it is the executable is supposed to build.

CMake doesn't have God-like powers to find executables out in the universe (or even on your PC) unless you tell it where to look. That's done either with your system PATH, CMake variables, or a combination of them. Setting the PATH or a CMake variable isn't a "workaround", it's how the thing works. Look at cmake-gui (http://www.cmake.org/cmake/help/runningcmake.html).