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

# linkedLibrary(_:_:)

Declares linkage to a system library.

```
static func linkedLibrary(_ library: String, _ condition: BuildSettingCondition? = nil) -> LinkerSetting
```

## Parameters

`library`

The library name.

`condition`

A condition that restricts the application of the build
setting.

## Discussion

This setting is most useful when the library can’t be linked
automatically, such as C++ based libraries and non-modular libraries.

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