In an ideal world, you should use the same code, and the buildsystem should make the buildsystem related data just work.
You could use the following scopes in your qmake project file:
mac: INCLUDEPATH += mac-specific-include-path
unix: INCLUDEPATH += unix-specific-include-path
win32: INCLUDEPATH += win32-specific-include-path
etc...
The source code will include the header files like this, then:
#include <SDL_main.h>
I would suggest to leave out the module prefix because that may hide bugs in the build system. That being said, in some projects you need to follow the convention regardless what looks more reasonable to someone.
This will ensure that if you switch port your code to another platform, you will need to make the code more complex that you probably read and modify often as the maintainer.
For sure, this also had the disadvantage that you need to reimplement this logic if you switch to a new buildsystem like cmake
or QBS
, but I would still recommend solving these issues on the buildsystem layer because nice source code is important.