# SwiftPM - Binary target with sub-dependencies

**URL:** <https://forums.swift.org/t/swiftpm-binary-target-with-sub-dependencies/40197>\
**Category:** Using Swift\
**Tags:** packagemanager, binary-framework, sub-dependency\
**Created:** [September 11, 2020, 11:27am UTC](https://forums.swift.org/t/swiftpm-binary-target-with-sub-dependencies/40197 "2020-09-11T11:27:34Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![bielikb](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/bielikb/32/2996_2.png) [@bielikb](https://forums.swift.org/u/bielikb)\
**Post date:** [September 12, 2020, 7:59pm UTC](https://forums.swift.org/t/swiftpm-binary-target-with-sub-dependencies/40197/7 "2020-09-12T19:59:58Z")

</div>

First of all, @paulb777 @SDGGiesbrecht thanks for the help folks. Without your guidance & real world example, I wouldn't be able to find the right solution!

My manifest file for _frameworkC_ that's dependent on _frameworkA_ now looks like this:

1. It lists the binary target both for _frameworkC_ and _frameworkA_
2. It declares additional (stub) target **FrameworkCTargets** , that has 2 target dependencies -\> _frameworkC_ and _frameworkA_
3. Additionally, the stub target _FrameworkCTargets_ declares the custom path towards dummy(empty) source file.
4. **NOTE:** I had to commit an empty source file (.m or .swift) to `FrameworkCTargets` subfolder on my repo, for the target `FrameworkCTargets` to be properly processed when integrated to project X. Without commiting the dummy source file for the stub target to the repo with the manifest, the libSwiftPM just thrown an error about missing source files.
5. Product _frameworkC_'s only target is the _FrameworkCTargets_

```swift
// swift-tools-version:5.3
import PackageDescription
let package = Package(
    name: "FrameworkC",
    platforms: [
        .iOS(.v13)
    ],
    products: [
        .library(
            name: "FrameworkC",
            targets: ["FrameworkCTargets"]
        )
    ],
    targets: [
        .binaryTarget(
            name: "FrameworkC",
            url: "url-to-framework-c",
            checksum: "checksum"
        ),
        .binaryTarget(
            name: "FrameworkA",
            url: "url-to-framework-a",
            checksum: "checksum"
        ),
        .target(name: "FrameworkCTargets",
                dependencies: [
                    .target(name: "FrameworkA", condition: .when(platforms: .some([.iOS]))),
                    .target(name: "FrameworkC", condition: .when(platforms: .some([.iOS])))
                ],
                path: "FrameworkCTargets"
        )
    ],
    swiftLanguageVersions: [.v5]
)

```

I hope this helps somebody else, too.

Furtherly, I believe, declaring binary subdepedencies in Package.swift could be done in a way more declarative/straightforward way by following the similar rules that are outlined for non-binary targets.  
Should I use feedbackassistant to report this back to Apple team?

---

_[View the full topic](https://forums.swift.org/t/swiftpm-binary-target-with-sub-dependencies/40197)._
