I have two platform toolsets: v110 and v110_xp for my project, and depending on the chosen platform I want to include/exclude part of the code to be compiled.
_MSC_FULL_VER
and $(PlatformToolsetVersion)
have exactly the same value for both of these platform toolsets. Alternatively, I tried to use $(PlatformToolset)
as follows:
_MSC_PLATFORM_TOOLSET=$(PlatformToolset)
but the problem is that $(PlatformToolset)
is non-numeric. Was wondering how can I use this non-numeric value as a preprocessor directive?
Trying several solutions I figured out that
_MSC_PLATFORM_TOOLSET='$(PlatformToolset)'
and then
#if (_MSC_PLATFORM_TOOLSET=='v110')
[Something]
#endif
works fine but
#if(_MSC_PLATFORM_TOOLSET == 'v110_xp')
[SomethingElse]
#endif
results in "too many character in character constant" error.
For the context please see this similar question: Visual Studio: how to check used C++ platform toolset programmatically