Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

get login name in qmake script



  • 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



  • Something like this:

    MYUSERNAME=NO_USERNAME
    win32 {
    MYUSERNAME = $$(USERNAME)
    }
    unix {
    MYUSERNAME = $$(USER)
    }
    message(The username is $$MYUSERNAME)
    


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


Log in to reply