ClTask Class

Summary

Compiles C/C++ programs using cl.exe, Microsoft's C/C++ compiler.
Assembly
NAnt.VisualCpp.dll
Namespace
NAnt.VisualCpp.Tasks
Interfaces
Base Types
graph BT Type-->Base0["ExternalProgramBase"] click Base0 "/api/NAnt.Core.Tasks/ExternalProgramBase" Base0-->Base1["Task"] click Base1 "/api/NAnt.Core/Task" Base1-->Base2["Element"] click Base2 "/api/NAnt.Core/Element" Base2-->Base3["Object"] Type-.->Interface0["IConditional"] click Interface0 "/api/NAnt.Core/IConditional" Type["ClTask"] class Type type-node

Syntax

[TaskName("cl")]
public class ClTask : ExternalProgramBase, IConditional

Examples

Compiles helloworld.cpp for the Common Language Runtime.

    <cl outputdir="build" options="/clr">
    <sources>
        <include name="helloworld.cpp" />
    </sources>
</cl>

Remarks

This task is intended for version 13.00.9466 of cl.exe.

Attributes

Type Description
TaskNameAttribute Indicates that class should be treated as a task.

Constructors

Name Summary
ClTask() Initializes a new instance of the NAnt.VisualCpp.Tasks.ClTask class.

Fields

Name Constant Value Summary
UnknownExitCode -1000
Defines the exit code that will be returned by NAnt.Core.Tasks.ExternalProgramBase.ExitCode if the process could not be started, or did not exit (in time).
Inherited from ExternalProgramBase
static

Properties

Name Value Summary
Arguments ArgumentCollection
The command-line arguments for the external program.
Inherited from ExternalProgramBase
BaseDirectory DirectoryInfo
Gets the working directory for the application.
Inherited from ExternalProgramBase
CharacterSet CharacterSet
Tells the compiler to use the specified character set.
CommandLine string
Gets the command-line arguments, separated by spaces.
Inherited from ExternalProgramBase
CustomXmlProcessing bool
Gets a value indicating whether the element is performing additional processing using the NAnt.Core.Element.XmlNode that was used to initialize the element.
Inherited from Element
Defines OptionCollection
Macro definitions to pass to cl.exe. Each entry will generate a /D
ErrorWriter TextWriter
Gets or sets the System.IO.TextWriter to which error output of the external program will be written.
Inherited from ExternalProgramBase
ExeName string
The name of the executable that should be used to launch the external program.
Inherited from ExternalProgramBase
ExitCode int
Gets the value that the process specified when it terminated.
Inherited from ExternalProgramBase
FailOnError bool
Determines if task failure stops the build, or is just reported. The default is true.
Inherited from Task
ForcedUsingFiles FileSet
Specifies metadata files to reference in this compilation as an alternative to passing a file name to #using in source code.
IfDefined bool
If true then the task will be executed; otherwise, skipped. The default is true.
Inherited from Task
IncludeDirs FileSet
The list of directories in which to search for include files.
Location Location
Gets or sets the location in the build file where the element is defined.
Inherited from Element
LogPrefix string
The prefix used when sending messages to the log.
Inherited from Task
Managed ManagedExecution
Specifies whether the external program should be treated as a managed application, possibly forcing it to be executed under the currently targeted version of the CLR.
Inherited from ExternalProgramBase
ManagedExtensions bool
Specifies whether Managed Extensions for C++ should be enabled. The default is false.
MetaDataIncludeDirs FileSet
Directories that the compiler will search to resolve file references passed to the #using directive.
Name string
The name of the task.
Inherited from Task
NamespaceManager XmlNamespaceManager
Gets or sets the System.Xml.XmlNamespaceManager.
Inherited from Element
ObjectFile string
A name to override the default object file name; can be either a file or directory name. The default is the output directory.
Options string
Options to pass to the compiler.
Output FileInfo
Gets the file to which the standard output should be redirected.
Inherited from ExternalProgramBase
OutputAppend bool
Gets a value indicating whether output will be appended to the NAnt.Core.Tasks.ExternalProgramBase.Output.
Inherited from ExternalProgramBase
OutputDir DirectoryInfo
Directory where all output files are placed.
OutputWriter TextWriter
Gets or sets the System.IO.TextWriter to which standard output messages of the external program will be written.
Inherited from ExternalProgramBase
Parent Object
Gets or sets the parent of the element.
Inherited from Element
PchFile string
Specifies the path and/or name of the generated precompiled header file - given either relative to NAnt.VisualCpp.Tasks.ClTask.OutputDir or as an absolute path.
PchMode ClTask.PrecompiledHeaderMode
The mode in which the specified NAnt.VisualCpp.Tasks.ClTask.PchFile (if any) is used. The default is NAnt.VisualCpp.Tasks.ClTask.PrecompiledHeaderMode.Use.
PchThroughFile string
The path of the boundary file when generating/using the specified NAnt.VisualCpp.Tasks.ClTask.PchFile. If a precompiled header file is not specified then this attribute is ignored.
ProcessId int
Gets the unique identifier for the spawned application.
Inherited from ExternalProgramBase
ProgramArguments string
Gets the command-line arguments for the external program.
ProgramDatabaseFile string
A name for the compiler-generated PDB file; can be either a file or directory name. The default is the output directory.
ProgramFileName string
Gets the filename of the external program to start.
Project Project
Gets or sets the NAnt.Core.Element.Project to which this element belongs.
Inherited from Element
Properties PropertyDictionary
Gets the properties local to this NAnt.Core.Element and the NAnt.Core.Element.Project.
Inherited from Element
Sources FileSet
The list of files to compile.
Spawn bool
Gets or sets a value indicating whether the application should be spawned. If you spawn an application, its output will not be logged by NAnt. The default is false.
Inherited from ExternalProgramBase
Threshold Level
Gets or sets the log threshold for this NAnt.Core.Task. By default the threshold of a task is NAnt.Core.Level.Debug, causing no messages to be filtered in the task itself.
Inherited from Task
TimeOut int
The maximum amount of time the application is allowed to execute, expressed in milliseconds. Defaults to no time-out.
Inherited from ExternalProgramBase
Undefines OptionCollection
Macro undefines (/U) to pass to cl.exe.
UnlessDefined bool
Opposite of NAnt.Core.Task.IfDefined. If false then the task will be executed; otherwise, skipped. The default is false.
Inherited from Task
UseRuntimeEngine bool
Specifies whether the external program is a managed application which should be executed using a runtime engine, if configured. The default is false.
Inherited from ExternalProgramBase
Verbose bool
Determines whether the task should report detailed build log messages. The default is false.
Inherited from Task
XmlNode XmlNode
Gets or sets the XML node of the element.
Inherited from Element

Methods

Name Value Summary
CopyTo(Element) void
Copies all instance data of the NAnt.Core.Element to a given NAnt.Core.Element.
Inherited from Element
Execute() void
Executes the task unless it is skipped.
Inherited from Task
ExecuteTask() void
Compiles the sources.
GetAttributeConfigurationNode(FrameworkInfo, string) XmlNode
Locates the XML node for the specified attribute in either the configuration section of the extension assembly or the.project.
Inherited from Task
GetAttributeConfigurationNode(XmlNode, FrameworkInfo, string) XmlNode
Inherited from Element
GetLocation() Location
Retrieves the location in the build file where the element is defined.
Inherited from Element
GetObjOutputFile(string, string) string
Determines the file name of the OBJ file for the specified source file.
static
Initialize() void
Initializes the task.
Inherited from Task
Initialize(XmlNode) void
Performs default initialization.
Inherited from Element
InitializeBuildElement(Element, XmlNode, Element, Type) Element
Initializes the build element.
Inherited from Element
static
InitializeElement(XmlNode) void
Derived classes should override to this method to provide extra initialization and validation not covered by the base class.
Inherited from Element
InitializeTask(XmlNode) void
Initializes the task.
Inherited from Task
InitializeTaskConfiguration() void
Initializes the configuration of the task using configuration settings retrieved from the NAnt configuration file.
Inherited from Task
InitializeXml(XmlNode, PropertyDictionary, FrameworkInfo) void
Initializes all build attributes and child elements.
Inherited from Element
IsLogEnabledFor(Level) bool
Determines whether build output is enabled for the given NAnt.Core.Level.
Inherited from Task
Log(Level, string) void
Logs a message with the given priority.
Inherited from Task
Log(Level, string, Object[]) void
Logs a formatted message with the given priority.
Inherited from Task
NeedsCompiling() bool
Determines if the sources need to be compiled.
PrepareProcess(Process) void
Updates the System.Diagnostics.ProcessStartInfo of the specified System.Diagnostics.Process.
Inherited from ExternalProgramBase
QuoteArgumentValue(string) string
Quotes an argument value and duplicates trailing backslahes.
static
StartProcess() Process
Starts the process and handles errors.
Inherited from ExternalProgramBase