[SOLVED]Write QMAKE replace function



  • Well, as I mentioned somewhere...I have got function:
    @defineReplace(getLibraryTarget) { NAME = $$1 return(quote($${PROJECT}.$$NAME)) }@
    But it returns just $$NAME (not $$PROJECT), when I tested this variable, shows correct message, but when I compiled this code, it returns just $$NAME as target...I really don't know where could be a problem...

    So the correct name of that library should be:
    @Project.LibraryName.dll@
    But it is just:
    @LibraryName.dll@

    how to rewrite this function?...



  • You'll have to show how you use it.



  • @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.



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



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



  • Is PROJECT set before you define the function?



  • yes, it is.



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



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



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



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



  • 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?)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.