开发者

qmake platform scopes

A standard c++ qmake-based library is developed for Win32, Mac, and Linux. In the qmake project file, the platform-dependent sources are included like this:

win32 {
     SOURCES += WinSystem.cpp
     HEADERS += WinSystem.h
 }

macx {
     SOURCES += MacSystem.cpp
     HEADERS += MacSystem.h
}

unix {
     SOURCES += LinuxSystem.cpp
     HEADERS += Linu开发者_如何学GoxSystem.h
}

Now on OS X both unix and macx are defined, so the Linux files are also included and cause error! What is the solution to this?


You can negate and combine blocks, so in unix but not in mac would be:

unix:!macx {
  SOURCES += LinuxSystem.cpp
  HEADERS += LinuxSystem.h
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜