Qmake: Distinguish between Mac OS X and Solaris



  • Hello,

    I am working on a project that will be developed on Mac OS X and deployed to Solaris 10 and OpenIndiana servers. The code requires slightly different linker flags to compile on these platforms. How do I add specific rules for these platforms to the qmake file? I tried:

    @
    unix: LIBS +=
    -L/usr/local/reflex/lib -lReflex
    -L/usr/local/poco/lib -lPocoFoundation -lPocoNet -lPocoXML -lPocoUtil
    -lsocket

    macx: LIBS +=
    -L/usr/local/reflex/lib -lReflex
    -L/usr/local/poco/lib -lPocoFoundation -lPocoNet -lPocoXML -lPocoUtil
    @

    However, the unix: setting seems to over-ride the macx: setting.

    Thanks
    Rakesh

    [EDIT: code formatting, please wrap in @-tags, Volker]



  • You can add sub-scopes. The mac is unix too, so both of the scopes would match. I would write it like this:

    @
    unix {
    !macx {
    LIBS +=
    -L/usr/local/reflex/lib -lReflex
    -L/usr/local/poco/lib -lPocoFoundation -lPocoNet -lPocoXML -lPocoUtil
    -lsocket
    } else {
    LIBS +=
    -L/usr/local/reflex/lib -lReflex
    -L/usr/local/poco/lib -lPocoFoundation -lPocoNet -lPocoXML -lPocoUtil
    }
    }
    @

    or simplified:

    @
    unix {
    LIBS +=
    -L/usr/local/reflex/lib -lReflex
    -L/usr/local/poco/lib -lPocoFoundation -lPocoNet -lPocoXML -lPocoUtil

    !macx: LIBS += -lsocket
    

    }
    @



  • Perfect, thanks!

    Rakesh


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.