Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] lrelease with OUT_PWD
Forum Update on Monday, May 27th 2025

[SOLVED] lrelease with OUT_PWD

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 2 Posters 4.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dMathieuD
    wrote on last edited by
    #1

    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:
    -myProjectBuildDir
    -myProjectSourceDir
    --myProjectProFile
    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

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      What errors exactly do you get when running lrelease?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dMathieuD
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dMathieuD
          wrote on last edited by
          #4

          Any suggestion on how is managed OUT_PWD ?

          1 Reply Last reply
          0
          • L Offline
            L Offline
            loladiro
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dMathieuD
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                loladiro
                wrote on last edited by
                #7

                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
                @

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved