[SOLVED] How to make windres understand empty spaces in macro definitions



  • Using Windows, I have a .rc file that uses macro definitions. One of those definitions is defined as:

    .pro
    @
    defineReplace(quoteMacroValue) {
    QUOTED_VAL =
    !isEmpty(ARGS) {
    QUOTED_VAL = "$$quote($$ARGS)"
    }

    return ($$QUOTED_VAL)
    }

    LEGAL_TRADEMARKS = All Rights Reserved
    DEFINES*=LEGAL_TRADEMARKS_RC=$$quoteMacroValue($$LEGAL_TRADEMARKS)
    @

    .rc
    @
    #define MAKESTRING(x) #x
    #define EXPAND_MACRO_ARGS_COUNT_1(a) MAKESTRING(a)

    ...

    BEGIN
    BLOCK "StringFileInfo"
    BEGIN
    BLOCK "040904E4"
    BEGIN

            ...
            
            VALUE "LegalTrademarks",    EXPAND_MACRO_ARGS_COUNT_1(WINDOWS_RC_FILE_LEGAL_TRADEMARKS)
    
            ...
    
        END
    END
    
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
    

    END
    @

    When building using MSVC it uses rc resource compiler and it handles the code perfectly well and All Rights Reserved is interpreted as single string when declared as a value for the preprocessor definition LEGAL_TRADEMARKS_RC.

    However gcc calls windres and it doesn't couple up the words All, Rights and Reserved into a single string (the actual value of the preprocessor definition), but uses the first one only I think - All and thinks that the rest two - Rights and Reserved are some command-line options to itself (windres).

    Probably I should play with the quotes in the:
    @
    QUOTED_VAL = "$$quote($$ARGS)"
    @

    line?

    How could I specify the macro value, so that the empty spaces are treated as part of the macro's value?



  • I found the solution. Instead of:

    @
    "$$quote($$ARGS)"
    @

    use:
    @
    $$join(ARGS, \x20)
    @


Log in to reply
 

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