I have to build project using MSVC2012 and v100 platform toolset (from MSVC2010). Unfortunately I'm using C++11 feature "range based for" across the code. I wondering if there is a preprocessor directive that allows to know current platform toolset in compile time. I.e
#if (_MSC_PLATFORM_TOOLSET > 100)
# define ALLOW_RANGE_BASED_FOR 1
#else
# define ALLOW_RANGE_BASED_FOR 0
#endif
I tried use _MSC_VER macro, but for both platform toolsets it is set to 1700 (and this does make sense, because I'm still using MSVC2012). I'd appreciate any suggestion. Thank you.
I encountered the same problem and added my own preprocessor definition for _MSC_PLATFORM_TOOLSET
.
In the project properties in
add _MSC_PLATFORM_TOOLSET=$(PlatformToolsetVersion) to make Visual Studio integrate the current Toolset's version to the preprocessor so that your query
#if (_MSC_PLATFORM_TOOLSET > 100)
...
#endif
will finally work.