Please note:The SCons wiki is in read-only mode due to ongoing spam/DoS issues. Also, new account creation is currently disabled. We are looking into alternative wiki hosts.
Differences between revisions 4 and 5
Revision 4 as of 2006-11-30 20:57:25
Size: 1317
Editor: proxyle02
Comment: Seems that my technique requires both MSVS and MSVS_VERSION environment dictionary elements.
Revision 5 as of 2008-03-12 02:47:01
Size: 1317
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Selecting MSVS version

By default, Scons' MSVS tool uses the highest installed version of MSVS for the compiler. To change this, you must change the MSVS_VERSION construction variable.

  # This creates an environment which will use the 6.0 compiler even if higher
  # versions are installed on the machine.
  env60 = Environment(MSVS_VERSION = '6.0')

  # This creates an option the developer can use to select between v6.0 and
  # v7.1.  If no option is specified, the environment will revert to the regular
  # behavior (highest installed version).
  opts = Options()
  opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None,
    allowed_values=('6.0', '7.1)))
  envOption = Environment(options = opts)


This worked for me:

opts = Options("SConsOptions")

opts.AddOptions(
    EnumOption("TOOL", "The tool chain to use", defaultTool, ("vc6", "vc8", "gnu"))
    )

env = Environment(options = opts)
Help(opts.GenerateHelpText(env))

if env["TOOL"] == "vc6":
    env["MSVS"] = {"VERSION": "6.0"}
    env["MSVS_VERSION"] = "6.0"
    Tool("msvc")(env)
elif env["TOOL"] == "vc8":
    env["MSVS"] = {"VERSION": "8.0"} 
    env["MSVS_VERSION"] = "8.0"
    Tool("msvc")(env)
elif env["TOOL"] == "gnu":
    Tool("g++")(env)

-- IlguizLatypov

MsvsMultipleVersions (last edited 2008-03-12 02:47:01 by localhost)