qmake platform scopes

偶尔善良 提交于 2019-12-04 02:47:11

问题


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 += LinuxSystem.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?


回答1:


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

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


来源:https://stackoverflow.com/questions/6371363/qmake-platform-scopes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!