---
title: "define(_:to:_:)"
framework: packagedescription
role: symbol
role_heading: Type Method
path: "packagedescription/cxxsetting/define(_:to:_:)"
---

# define(_:to:_:)

Defines a value for a macro.

## Declaration

```swift
static func define(_ name: String, to value: String? = nil, _ condition: BuildSettingCondition? = nil) -> CXXSetting
```

## Parameters

- `name`: The name of the macro.
- `value`: The value of the macro.
- `condition`: A condition that restricts the application of the build setting.

## Discussion

Discussion If you don’t specify a value, the macro’s default value is 1. note: First available in PackageDescription 5.0.

## See Also

### Configuring CXX Settings

- [headerSearchPath(_:_:)](packagedescription/cxxsetting/headersearchpath(_:_:).md)
- [unsafeFlags(_:_:)](packagedescription/cxxsetting/unsafeflags(_:_:).md)
