visual-studiomsbuild

how to customize the build of a visual c 2010 project to use different compiler and linker?


We have a Visual Studio 2010 project that comprises of a bunch of C source files.

These files need to be compiled and then linked using a special tool chain for an embedded device.

Currently, we are compiling it in Visual Studio using the default C++ build and then, in the post build event we are invoking the tool chain for the embedded device.

I am wondering if there is some way to make Visual Studio compile and link using our tool chain instead of Microsoft's.

I tried to override the Build target, and had some progress with that, however when project properties gets changed by a developer, then the project's vcxproj file gets overwritten.

What is the proper way to override the Build target?


Solution

  • The proper way to use custom tool chain with Visual Studio 2010 is to set custom platform toolset:

    <PlatformToolset>Intel C++ Compiler XE 12.1</PlatformToolset>
    

    Here, I am using Intel C++ Compiler. When building the project MSBuild looks for platform toolset in directory:

    c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\$(Architecture)\PlatformToolsets\
    

    where $(Architecture) is x64, Win32 etc.

    But, to use your custom tool chain you will have to write MSBuild configurations files. In my case Intel C++ Compiler comes with such files. So, all I need to do - is to set proper platform toolset (this can be done from Visual Studio 2010 in project properties window).

    Here the link to article from Visual C++ Team Blog where you can find more details: C++ Native Multi-Targeting