Quantcast
Channel: Package Manager - Swift Forums
Viewing all articles
Browse latest Browse all 166

SPM Package.swift linkerSettings passed to dependent main app target

$
0
0

Linker flag specified in Package.swift as unsafe flag is passed to main app target.
steps:
create empty package
add linkerSettings: [.unsafeFlags(["-Wl,-make_mergeable"])] to target

import PackageDescription

let package = Package(
    name: "TestPackage",
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "TestPackage",
            type: .dynamic,
            targets: ["TestPackage"]),
    ],
    targets: [
        // Targets are the basic building blocks of a package, defining a module or a test suite.
        // Targets can depend on other targets in this package and products from dependencies.
        .target(
            name: "TestPackage",
            linkerSettings: [.unsafeFlags(["-Wl,-make_mergeable"])]
        ),
        .testTarget(
            name: "TestPackageTests",
            dependencies: ["TestPackage"]),
    ]
)

create empty Xcode iOS app project
add package to project via Add Files

add package as a framework dependency to the main app

build fails with error:

ld: -make_mergeable can only be used when creating a dynamic library

package itself builds with -mergable_library and that is fine

but why main app target has to inherit same linker setting from package?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 166

Trending Articles