Important: Please read the 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

  • Something like this:

    win32 {
    unix {
    message(The username is $$MYUSERNAME)

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

Log in to reply