Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Write QMAKE replace function
Qt 6.11 is out! See what's new in the release blog

[SOLVED]Write QMAKE replace function

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 7.5k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    loladiro
    wrote on last edited by
    #2

    You'll have to show how you use it.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #3

      @defineReplace(getLibraryName) {
      NAME = $$1
      return ($$quote(${PROJECT}.$$NAME))
      }@

      works fine. The problem mainly is that PROJECT isn't something qmake sets. What do you expect PROJECT to return? The project name? If I have the following:
      @PROJECT = gnarl
      defineReplace(getLibraryName) {
      NAME = $$1
      return ($$quote(${PROJECT}.$$NAME))
      }

      message($$getLibraryName(huuhaa.dll))@

      I get
      @Project MESSAGE: gnarl.huuhaa.dll@
      as output.

      If I don't set PROJECT, I get
      @Project MESSAGE: .huuhaa.dll@
      which indicates qmake doesn't do anything with the variable.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

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

        He said he gets:
        @LibraryName.dll@
        not
        @.LibraryName.dll@
        which indicates to me that he is not using it properly.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Peppy
          wrote on last edited by
          #5

          I am using it:
          @TARGET = $$getLibraryName(LibraryProject)@
          Yes, the variable $$PROJECT is set up (in .pri file, where is also defined that function)

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Franzk
            wrote on last edited by
            #6

            Is PROJECT set before you define the function?

            "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Peppy
              wrote on last edited by
              #7

              yes, it is.

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

                See what you get with
                @message($$TARGET)@

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  Peppy
                  wrote on last edited by
                  #9

                  well...nothing. It is empty...

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    Peppy
                    wrote on last edited by
                    #10

                    I tried:
                    @message($$TARGET)
                    message($$setLibraryTarget(Configuration))
                    @
                    Both are NULL (empty)...

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

                      Before or after you use
                      @TARGET = $$getLibraryName(LibraryProject)@
                      How is setLibraryTarget defined?

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        Peppy
                        wrote on last edited by
                        #12

                        Used in Library project:
                        @include(../../../Project.pri)
                        QT += xml xmlpatterns

                        TARGET = $$setLibraryTarget(Configuration)
                        @

                        Defined in project include file ( .pri )
                        @defineReplace(setLibraryTarget){ NAME = $$1 return($$quote(${SYDNEYSTUDIO_PROJECT_NAME}.$$NAME)) }@

                        Well, when I removed Makefile and wrote is on multi-lines, it works...thanks for help.

                        So solution is, do not write QMAKE function as inline :D :D

                        But, there is another problem with my QMAKE (new thread?)

                        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