Welcome to MSDN Blogs Sign in | Join | Help

Using different toolsets for vc build

Hi,

 

I am Olga Arkhipova and I am a VC IDE developer. I joined VC team about two years ago and inherited vc project and build system.  I’ve been using VC since VC2, so for me it is quite interesting to see and work on the code I’ve been using (or sometimes not using, because it did not do what I needed) for so long J

 

As VS9 has now shipped together with new compilers and libraries, several people inside Microsoft asked me how vc build finds its build tools (cl, link, different libraries and includes) and if it is possible to use a different VC toolset rather than those installed with VS (for instance, use vs9 from vs8 and vice versa, or a particular SDK toolset), so I decided it might be useful  to blog about this question for other people. Yes, it is possible and the information on how to do this does exist on MSDN, but it appears to be hard to find and it is split into pieces.

 

To define a toolset for the command line build you need to:

 

·         Set INCLUDE, LIB, LIBPATH and PATH environment variables to point to the corresponding directories of the toolset you want to use (LIBPATH is for managed References dirs). Something like

set  MyToolSetRoot =c:\ MyToolSet

set INCLUDE="%MyToolSetRoot%\include;%MyToolSetRoot%\atlmfc\include;%MyToolSetRoot%\SDK\include;

 

·         Run ‘devenv /useenv’ or ‘vcbuild /useenv’ to force using defined locations instead of standard VS ones.

 

Note that those directories you set will be used for all platforms, so if you need to build for more than one platform, you’ll have to define INCLUDE, LIB, LIBPATH and PATH for each of them and build them separately, say, by running ‘vcbuild /platform:<str> …’

 

To see what VS9 (and I believe VS8) sets for different platforms, you can take a look at

c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vsvars32.bat

 

And if you installed 64-bit platform support:

c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\x86_ia64\vcvarsx86_ia64.bat   (cross platform tools)

c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat (cross platform tools)

c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\ia64\vcvarsia64.bat ( native 64-bit tools, installs only on 64bit OS)

c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat ( native 64-bit tools, installs only on 64bit OS)

 

 

You can also change the vc build toolset for the VS IDE.

 

Start VS,  go to Tools – Options - Projects and Solutions - VC++ Directories  and modify directories for ‘Executable files’, ‘Include files’, ‘Library files’ and ‘Reference files’ to point to your toolset directories. You can use environment variables as macros there. For instance, if you have ‘MyToolSetRoot’ environment variable defined on your machine, for ‘Include files’ you can set:

 

$( MyToolSetRoot)\include

$( MyToolSetRoot)\atlmfc\include

$( MyToolSetRoot)\SDK\include

 

Do this for all platforms you build for. Close the dialog. These will modify the options per user/per machine. If you want to switch between different VC directories on your machine or share them to another machine, in VS9 and VS8(sp1) you can use Tools - Import/Export settings (VS8 does not support this). The VC++ directories are not imported/exported by default (as they might contain only this machine specific directories), so you need to check  All Settings – Options – Projects – VC++ Directories explicitly.

 

Thanks,

Olga

Published Sunday, December 30, 2007 9:34 PM by vcblog

Comments

# Geek Lectures - Things geeks should know about &raquo; Blog Archive &raquo; Using different toolsets for vc build

Monday, December 31, 2007 3:18 AM by Phaeron

# re: Using different toolsets for vc build

Another way to switch the tools in the IDE is to run vcvars32.bat for the toolset you want and then launch devenv /useenv. This is handy for using the Platform SDK compiler toolchain and doesn't require permanent settings changes.

Monday, December 31, 2007 11:15 AM by David V. Corbin

# re: Using different toolsets for vc build

I have been using these techiques for quite a while (after much struggling to find a way).

GREAT to see an "offical" blog post that this is in fact the way to do it.

Saturday, January 05, 2008 11:29 AM by Martin Richter [MVP C++]

# re: Using different toolsets for vc build

Isn't it much easier to use the property manager to apply changes to a project that are different from the standard?

In this case you have the settings inside the project and you don't need to worry how to launch the VS-IDE for a specific project?

Sunday, January 06, 2008 3:04 AM by ShaggyOwl

# re: Using different toolsets for vc build

Looks like Import not worked properly for VC++ Directories (VS8(sp1) Express).

1. I add test path to VC++ Directories\Executable files

2. Export options. File test.vssettings contains test path in node <PropertyValue name="ExecutableDirectories">

3. After Import, test directory not added in VC++ Directories.

Tuesday, January 08, 2008 3:14 PM by Olga Arkhipova

# re: Using different toolsets for vc build

Sorry I did not reply earlier, this year we had quite long holidays :)

To ShaggyOwl:

Unfortunatelly you are right, it does not work in 2005 SP1. We made a hot fix and I thought it was before SP1, but I was wrong, it is not included there. Here is the link for the KB article for this problem:

http://support.microsoft.com/kb/934276

To get the fix you need to call

(800) MICROSOFT (642-7676)

Microsoft Customer Support Services

and ask them for HotFix 934276. This is free of charge.

Sorry for confusion.

Olga

Tuesday, January 08, 2008 4:05 PM by Olga Arkhipova

# re: Using different toolsets for vc build

To Martin Richter:

Yes, if you are OK to modify your projects/property sheets you can define INCLUDE, LIB, LIBPATH and PATH env vars in a property sheet using Property Manager.

http://msdn2.microsoft.com/en-us/library/f2t8ztwy(VS.80).aspx

Thanks for adding this.

Olga

Wednesday, February 27, 2008 2:43 PM by Steve Nuchia

# re: Using different toolsets for vc build

Can you provide more details as to how to set the PATH variable in propery sheets?

What I would like to do is insert a solution-specific tools directory into the path in a solution-wide vsprops file.  What's happening is that it is replacing the PATH setting rather than augmenting it.  Now sproxy.exe is found but cl.exe isn't!  That's not really any better than before.

Monday, October 06, 2008 3:12 PM by Microsoft Windows SDK Blog

# How to get the WinSDK Configuration Tool to work

The Windows SDK Configuration Tool sets which version of Windows SDK headers, libraries and tools you

New Comments to this post are disabled
 
Page view tracker