Details
Description
If a simple project depends only on the cpp module, one can set 'windowsApiCharacterSet:undefined' to get rid of the /DUNICODE and /D_UNICODE defines on windows. But this does not work, if there is an additional dependency to an other module, which depends itself on 'cpp':
import qbs 1.0 Application { ... Depends { name: 'cpp' } Depends { name: 'myModule' } cpp.windowsApiCharacterSet: undefined ... }
import qbs 1.0 Module { Depends { name: 'cpp' } ... // no further references to windowsApiCharacterSet here }
In this example the generated compiler call still contains \DUNICODE and \D_UNICODE. This can only be stopped by adding an additional
myModule.cpp.windowsApiCharacterSet: undefined
into the Application block. So the author of "main.qbs" must know internal details about myModule to specify compiler flags.
The reason for this may be in ...share/qbs/modules/cpp/windows-msvc.qbs because the lines
windowsApiCharacterSet: "unicode"
platformDefines: base.concat(Windows.characterSetDefines(windowsApiCharacterSet))
are called three times when using the example above. (Put a print() into Windows.characterSetDefines() to prove it.) I guess: one call for initialising qbs itself, another for the 'Depends' in the Application block and the 3rd call for the 'Depends' in the module 'myModule'.