Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QMAKE. How to figure out host platform and target platform when cross compiling QT projects

I compiling for QNX, ARM, My Host platform can be Win32/64 , Linux or Mac I want to find a way to see wheat is my host platform in my PRO file (on computer I building my project)

Apparently using:

win32 {}
unix {}
macx {}

does not work because on different OSes it will always report unix, so I assume this is target platform So what is the way to obtain current host platform to make PRO file flexible because on different platform I would like to do different things.

Thank you

like image 927
xchg.ca Avatar asked Sep 18 '14 15:09

xchg.ca


1 Answers

Maybe QMAKE_HOST variable is the answer to your question?

Here's information from official Qt documentation:

QMAKE_HOST

Provides information about the host machine running qmake. For example, you can retrieve the host machine architecture from QMAKE_HOST.arch.

  • .arch - Host architecture
  • .os - Host OS
  • .cpu_count - Number of available cpus
  • .name - Host computer name
  • .version - Host OS version number
  • .version_string - Host OS version string

win32-g++:contains(QMAKE_HOST.arch, x86_64):{ message("Host is 64bit") ... }

like image 80
Alexandr Zarubkin Avatar answered Sep 27 '22 23:09

Alexandr Zarubkin