Platform-specific settings
You can define different configurations for different platforms, since not every configuration can fit all use cases. For example, if you want to include different header paths for different operating systems, you can add the following lines of code to your .pro
file:
win32: INCLUDEPATH += "C:/mylibs/windows_headers" unix:INCLUDEPATH += "/home/user/linux_headers"
In the preceding code snippet, we have added some Windows-specific and Linux-specific header files. You can also put configurations such as if
statements in C++, as shown here:
win32 { SOURCES += windows_code.cpp }
The preceding code is intended only for Windows platforms, which is why we have added a win32
keyword before it. If your target platform is based on Linux, then you can add a unix
keyword to add Linux-specific configurations.
To set a custom icon for your application on the Windows platform, you should add the following line of...