<!--
{
  "availability" : [
    "SwiftPM: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/CXXSetting/define(_:to:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription10CXXSettingV6define_2to_ACSS_SSSgAA21BuildSettingConditionVSgtFZ"
  },
  "title" : "define(_:to:_:)"
}
-->

# define(_:to:_:)

Defines a value for a macro.

```
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

If you don’t specify a value, the macro’s default value is 1.

> Since: First available in PackageDescription 5.0.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)