visual-c++-2008visual-c++-2010

Macro for Visual Studio version


I am using the command line to automate a few things in my project. I am using a lot of macros, for example $(PlatformName) - gives me Win32 or Win64, which help me write commands for all configuration types. I am wondering if there is a similar macro that I can use for the current version of Visual Studio, for example one that will return VS2008 or VS2010.


Solution

  • It doesn't look like it. Here is a list of available macros. That's no guarantee there aren't other ways to detect the VC version in use, however; one option might be to work it out from the VCinstalldir by exploring subdirectories. Like any buildsystem activity this rapidly becomes a lot of special cases etc...