qmake: Test for current spec

2020-04-07 04:38发布

I would like to detect whether qmake is currently building using MingW (win32-gcc) or Visual Studio (win32-msvc200X).

At the moment I am using the following construct:

windows{
    contains(QMAKE_CC, gcc){
        # MingW
    }
    contains(QMAKE_CC, cl){
        # Visual Studio
    }
}

This does not seem particularly robust. Is there a better way?

1条回答
Evening l夕情丶
2楼-- · 2020-04-07 05:30

Probably not anymore robust, but different:

windows {
    *-g++* {
        # MinGW
    }
    *-msvc* {
        # MSVC
    }
}
查看更多
登录 后发表回答