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. get login name in qmake script
Forum Updated to NodeBB v4.3 + New Features

get login name in qmake script

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 284 Views 2 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.
  • B Offline
    B Offline
    Bart_Vandewoestyne
    wrote on 30 Nov 2021, 15:24 last edited by
    #1

    I am porting some Perl code to qmake. The Perl code gets the current login name with

    my($login_name) = lc getlogin;
    

    and uses that login name for replacing some text in a configuration file. I have translated the Perl code into a QMAKE_POST_LINK action that does the same textual replacement, but within my QMAKE_POST_LINK action i now also need that same login name.

    This should work on both Windows and Linux. Is there a way to get that login name in a qmake .pro file?

    See also https://perldoc.perl.org/functions/getlogin

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on 30 Nov 2021, 15:44 last edited by mchinand
      #2

      Something like this:

      MYUSERNAME=NO_USERNAME
      win32 {
      MYUSERNAME = $$(USERNAME)
      }
      unix {
      MYUSERNAME = $$(USER)
      }
      message(The username is $$MYUSERNAME)
      
      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bart_Vandewoestyne
        wrote on 30 Nov 2021, 15:59 last edited by
        #3

        Yes, thanks. That was also what I have figured out in the meanwhile :-)

        1 Reply Last reply
        1

        1/3

        30 Nov 2021, 15:24

        • Login

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