AddToolSettings Method
Home Page (Objects) | Overview | FAQ | Reference
Applies to: Configuration object
Changes the settings of a specified tool, such as the Visual C++ compiler.
Syntax
object**.AddToolSettingstool,** settings
Parameters
object
An expression that evaluates to a Configuration object.
tool
A String that contains the name of the tool whose settings you want to change. For the Visual C++ compiler, specify "cl.exe," and for the linker specify "link.exe."
settings
A String that includes the settings or command-line flags you want to add to your project. These flags apply to all files in the configuration. You can add multiple flags by separating them with spaces. For instance, you can specify "/D_NEW_SYMBOL /J" to add the flags "/D_NEW_SYMBOL" and "/J" to the compiler command line. If you try to add flags that already exist, Developer Studio will disregard them.
Remarks
The functionality of the AddToolSettings method appears in the Project Settings dialog box and on the tabs of each tool, such as the C/C++ and Link tabs.
There is a pseudo-tool, "mfc", which you can use to specify how the MFC libraries are used, by entering a value. These values can be seen in the General tab of the Project Settings dialog box (Project menu, Settings command), in the Microsoft Foundation Classes drop-down list.
Value | How the MFC Libraries Are Used |
0 | MFC is not used. |
1 | Using MFC in a static library. |
2 | Using MFC in a dynamic link library. |
Example
The following example adds a preprocessor define, used by the C++ compiler, to the project makefile, which is owned by a specified project and configuration:
Sub AddPreprocMacroDefine
If Projects(1).Type = "Build" Then
Projects(1).Configurations(1).AddToolSettings "cl.exe", "/D_DEFINEME"
End If
End Sub
See Also RemoveToolSettings method.