Important: Please read the Qt Code of Conduct -

[SOLVED] lrelease with OUT_PWD

  • Hi,

    I have a project file using OUT_PWD variable to copy file I need to configured for later packaging. When I'm building out-of-the-source means I have this project arch:
    using this command inside "myProjectBuildDir":
    @qmake ../myProjectSourceDir/myProjectProFile@
    everything is ok (OUT_PWD is set to "myProjectBuildDir" and all the compilation process goes well. But when I'm trying to do the same with lrelease:

    @lrelease ../myProjectSourceDir/myProjectProFile@
    I have the OUT_PWD not set and I have errors output.

    Thus I have two questions:
    *Why OUT_PWD is not set ?
    *Why lrelease is taking care of all the pro file steps ? I believed it was only taking care about TRANSLATIONS things...

    Thanks for your replies

  • What errors exactly do you get when running lrelease?

  • It's not really errors it's just that as I used OUT_PWD to copy a file for example:
    @system(cp myFile.txt $${OUT_PWD}/myFile.txt)@
    It copies it to /myFile.txt as OUT_PWD is empty. It only happens when using lrelease and not with qmake command.

  • Any suggestion on how is managed OUT_PWD ?

  • So the question is what you want to do. I think you have to option to patch lrelease and compile it yourself to add OUT_PWD being set, or (what I would do) is use the fact that OUT_PWD isn't set and put everything you don't want to be executed if lrelease is run into something like:
    !isEmpty( OUT_PWD ) {
    system(cp myFile.txt $${OUT_PWD}/myFile.txt)
    For option 1 just read the sources and qmake and lrelease actually have two different implementations of the pro file parser (it looks very similar in places, but the qmake one is longer), but it shouldn't be a problem to do that (although I wouldn't recommend it for reason of portability). I can provide a patch for that if you want to.

  • I implemented the second solution testing if OUT_PWD is empty. It's working well but I wonder why lrelease is taking care about other things than TRANSLATION var in the pro file.

  • The thing is that lrelease has to do everthing, in case there are translations uncovered by it. Consider for example:
    system(/path/to/Lang/script): TRANSLATIONS += secrect.ts
    or if that's not convincing, hoe about something like:
    system(/path/to/Lang/script): SUBDIRS += i18n

Log in to reply