[Interest] Qmake - Target platform vs Build platform

Phil Hannent phil at hannent.uk
Thu Nov 6 12:32:46 CET 2014


Hi,

I have a little problem. I am cross compiling an application targeting
Android (in addition to Windows/Mac and Linux). However the
development of Android happens on both OSX and Windows.

Currently I have the following:

android {
    message("Android")
    DEFINES += BUILDTIME=\\\"$$system('time/T')\\\"
    DEFINES += BUILDDATE=\\\"$$system('echo %date%')\\\"
} else {
    message("Desktop")
   win32 {
        DEFINES += BUILDTIME=\\\"$$system('time/T')\\\"
        DEFINES += BUILDDATE=\\\"$$system('echo %date%')\\\"
    }
    else {
        DEFINES += BUILDTIME=\\\"$$system(date '+%H:%M.%s')\\\"
        DEFINES += BUILDDATE=\\\"$$system(date '+%d/%m/%y')\\\"
    }
}

When the Android build happens on Windows it will have the time in
BUILDTIME, but when cross-compiled on a Mac I of course get an error:

sh: time/T: No such file or directory

What I have here is that the android is the target but I also need a
means of determining the build platform, is there anything in qmake
that handles that?

Many thanks
Phil Hannent



More information about the Interest mailing list