Alternate build integration methods for Visual Studio C/C++ projects
Alternate build integration methods for Visual Studio C/C++ projectskwinject creates the most accurate build specification and is the recommended build integration method for all C/C++ projects, including Visual Studio projects built from the command line (with devenv, msdev, vcbuild or msbuild). However, if you are unable to create a build specification for your Visual Studio C/C++ project with kwinject, this article explains alternate build integration methods. Before you begin: Build your Visual Studio project in Visual Studio before you attempt to create a Klocwork build specification. Building in Visual Studio first ensures that your project is properly set up, and that any files generated "on the fly" are available to the Klocwork tools. To create a build specification for a project with a .dsp, .dsw, .vcproj or .sln file, run kwdspparser or kwvcprojparser. If your Visual Studio project contains multiple platforms, you must specify the full configuration, including the platform. For example: kwvcprojparser project.vcproj -c "Debug|Itanium" Creating a build specification for multiple .dsp or .vcproj filesYou cannot specify more than one Microsoft Visual Studio project file per project. As a workaround, create a top-level solution or workspace file and use it to create your Klocwork project. To generate a build specification for multiple .dsp or .vcproj files:
Visual Studio 6 exampleThis example uses Visual Studio 6 with the open-source project WinCVS. Note: Our sample project contains a .dsp project file, so we're using the kwdspparser command to generate a build specification. If your project has a .vcproj file instead, use the kwvcprojparser command.
To gather information about the WinCVS software system and create a build specification:
Support for Visual Studio built-in macroskwvcprojparser and kwdspparser include support for Visual Studio built-in macros. Visual Studio substitutes environment variables of the form $(VARIABLE). Built-in Visual Studio macros and environment variables are expanded in the same manner. Most of the built-in macros are directly supported by the parsers. In the unlikely case that you encounter an unsupported macro, you see a message like the following: Processing configuration "Release|Win32" in project "f:\CVSREPOSITORY\Klocwork-HEAD\sources\remote_cxx\kwdistadmin.vcproj"... Warning: Environment variable "$(Klocwork_HOME)" is not set In such cases, define this variable in your environment. The easiest way is to open a command prompt and issue the following command: Set Klocwork_HOME=<your value> The value of the variable depends on the usage. In addition, the kwvcprojparser option /useenv instructs the parser to use the INCLUDE environment variable. Note that all paths specified in the INCLUDE environment variable are specified as "system includes" in the resultant build specification, and override any Visual Studio .NET 2003, 2005 or 2008 settings set in Tools > Options > Project > VC++ Directories. Note that kwdspparser does not have this functionality, and always uses Visual Studio 6 settings. What's next?Now that you've created a build specification, you're ready to run the C/C++ integration build analysis. |