Visual Studio: how to check used C++ platform toolset programmatically

后端 未结 4 2090
轮回少年
轮回少年 2021-02-07 12:44

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 wonderin

4条回答
  •  隐瞒了意图╮
    2021-02-07 13:24

    The macro _MSC_FULL_VER is different for each platform toolset; and version of Visual Studio. For the (current) Visual Studio 2013 preview, it is 180020617. For Visual Studio 2012 with the November 2012 Compiler CTP (which gave some C++11), it was 170060315. Like _MSC_VER, the first 4 digits are the same for each version of Visual Studio; for Visual Studio 2012 they are always 1700. Here's an example:

    #ifdef _MSC_FULL_VER
      #if   _MSC_FULL_VER == 170060315
      // MSVS 2012; Platform Toolset v110
      #elif _MSC_FULL_VER == 170051025
      // MSVS 2012; Platform Toolset v120_CTP_Nov2012
      #elif _MSC_FULL_VER == 180020617
      // MSVS 2013; Platform Toolset v120
      #endif
    #endif // _MSC_FULL_VER
    

提交回复
热议问题