Qt .pro file - how to add conditioning on OSX version?

197 views Asked by At

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?

1

There are 1 answers

2
Alexander V On BEST ANSWER

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