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

# enableWarning(_:_:)

Enable a specific C++ compiler warning group.

```
static func enableWarning(_ name: String, _ condition: BuildSettingCondition? = nil) -> CXXSetting
```

## Parameters

`name`

The name of the warning group to enable.

`condition`

A condition that restricts the application of the build setting.

## Discussion

Use this setting to enable a specific warning group. This is equivalent to passing
`-W` followed by the group name to the C++ compiler.

> Since: First available in PackageDescription 6.2.

---

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)