1

I have a Qt codebase shared between two development machines. One is OSX 10.8.5 and one is OSX 10.9.5.

The project won't compile on 10.9.5 unless I include:

QMAKE_MAC_SDK = macosx10.9

and thus I have two .pro files, one with/without that line. How can I have the .pro file conditionally include that line depending on the version of Mac OSX detected?

daj
  • 6,962
  • 9
  • 45
  • 79

1 Answers1

2

I recently found some info on that and it appears to be doable (applied once) with:

OS_VERSION = $$system(uname -r)                             # common to Unix
contains(OS_VERSION, VersionTag):SOURCES += example.c       # can apply to different options
contains(OS_VERSION, VersionTag):QMAKE_MAC_SDK = macosx10.9 # like that?

Answering Tay2510, for some reason only full string worked on Linux:

OS_VERSION = $$system(uname -r)
message($$OS_VERSION)
contains( OS_VERSION, 3.13.0-39-generic ) {
    message(Generic)
}

#Output:

Project MESSAGE: 3.13.0-39-generic
Project MESSAGE: Generic
Alexander V
  • 8,351
  • 4
  • 38
  • 47
  • Have you tested that? I am surprised that this information cannot be easily found in the document...not an OS user, just curious. – Tay2510 Nov 10 '14 at 03:21
  • 1
    Tay2510, cannot recall everything in details from my work but just tried on my Linux at home: OS_VERSION = $$system(uname -r) message($$OS_VERSION) contains( OS_VERSION, 3.13.0-39-generic ) { message(Generic) } – Alexander V Nov 10 '14 at 03:51