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. QMake $${LITERAL_DOLLAR}0 not expanded to command line at compile - Qt Creator, MacOS
Forum Update on Monday, May 27th 2025

QMake $${LITERAL_DOLLAR}0 not expanded to command line at compile - Qt Creator, MacOS

Scheduled Pinned Locked Moved Solved General and Desktop
qt creatorqmakedollarliteralmacosx
2 Posts 1 Posters 1.2k 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.
  • T Offline
    T Offline
    trevorS
    wrote on last edited by trevorS
    #1

    I am trying to pass $0 to the command line without success. While the qmake message function properly expands LITERAL_DOLLAR, it is not expanded on the command line at compile.

    You can see in the qmake code and compile output below that both the LITERAL_DOLLAR and proceeding 0 are omitted from the awk command.

    [QMake Code]

    MY_DIR = MyDir=/Library/mydir
    
    message("COMMAND awk 'NR==2 {$${LITERAL_DOLLAR}0=\"$${MY_DIR}\"} 1' myrc.sample > .myrc")
    
    myrcupdate.target   = .myrc
    myrcupdate.depends  = myrcupdateMessage
    myrcupdate.commands = awk \'NR==2 {$${LITERAL_DOLLAR}0=\"$${MY_DIR}\"} 1\' myrc.sample > .myrc
    
    myrcupdateMessage.commands = @echo Updating myrc entry $${MY_DIR}
    
    QMAKE_EXTRA_TARGETS += myrcupdate myrcupdateMessage
    PRE_TARGETDEPS      += .myrc
    

    [Compile Output]

    Project MESSAGE: COMMAND awk 'NR==2 {$0="MyDir=/Library/mydir"} 1' myrc.sample > .myrc
    Updating myrc entry MyDir=/Library/mydir
    awk: syntax error at source line 1
     context is
    	NR==2 >>>  {= <<< "MyDir=/Library/mydir"} 1
    awk: illegal statement at source line 1
    make[1]: *** [.myrc] Error 2
    make: *** [sub-MY_SUB_PROJECT-make_first-ordered] Error 2
    awk 'NR==2 {=MyDir=/Library/mydir} 1' myrc.sample > .myrc
    13:40:08: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project MY_PROJECT (kit: Desktop Qt 5.7.1 clang 64bit static)
    The kit Desktop Qt 5.7.1 clang 64bit static has configuration issues which might be the root cause for this problem.
    When executing step "Make"
    

    Is this qmake behaviour intentional ?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      trevorS
      wrote on last edited by
      #2

      While I'm still not successful to expand $${LITERAL_DOLLAR}0 to the command line at compile, I did resolve the generated compile error by changing from awk to sed.

      [Work around]

      Change...

      myrcupdate.commands = awk \'NR==2 {$${LITERAL_DOLLAR}0=\"$${MY_DIR}\"} 1\' myrc.sample > .myrc
      

      to...

      myrcupdate.commands = sed -i \'\' \'2s%.*%$${MY_DIR}%\'  .myrc
      
      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