I define the following custom variable at the project level:
<Variable name="port" value='"[[ $if (PLATFORM == PLATFORM_MSW) { print("WIN32") } { print("LINUX") } ]]"' />
Then use this variable in the compiler defines, also at the project level:
<Add option="-D$(port)" />
This doesn't produce the desired result however. The build log tells me:
<command-line>: error: macro names must be identifiers
IDK how to see the actual command line. My first thought was that the problem was that the script is itself within "..." but these seem to be inserted automatically by CB so I assume that is not the problem.
I have tried not using print():
<Variable name="port" value='"[[ $if (PLATFORM == PLATFORM_MSW) { WIN32 } { LINUX } ]]"' />
and
<Variable name="port" value='"[[ $if (PLATFORM == PLATFORM_MSW) { return WIN32 } { return LINUX } ]]"' />
But these both produce the same result. Any help?