 
     func generateTarget(_ target: Target) throws -> PBXNativeTarget {
 
-        let carthageFrameworks = Set(getCarthageFrameworks(target: target))
+        let carthageDependencies = getAllCarthageDependencies(target: target)
 
         let sourcePaths = target.sources.map { basePath + $0 }
         var sourceFilePaths: [Path] = []

            }

            // set Carthage search paths
            if !carthageFrameworks.isEmpty {
                let frameworkSearchPaths = "FRAMEWORK_SEARCH_PATHS"
                let carthagePlatformBuildPath = "$(PROJECT_DIR)/" + getCarthageBuildPath(platform: target.platform)
                var newSettings: [String] = []

            buildPhases.append(copyFilesPhase.reference)
        }

        let carthageFrameworksToEmbed = carthageDependencies
            .filter { ($0.embed ?? true) }
            .map { $0.reference }
        if !carthageFrameworksToEmbed.isEmpty {

            if target.type.isApp && target.platform != .macOS {
                let inputPaths = Set(carthageFrameworksToEmbed).map { "$(SRCROOT)/\(carthageBuildPath)/\(target.platform)/\($0)\($0.contains(".") ? "" : ".framework")" }
                let carthageScript = PBXShellScriptBuildPhase(reference: generateUUID(PBXShellScriptBuildPhase.self, "Carthage" + target.name), files: [], name: "Carthage", inputPaths: inputPaths, outputPaths: [], shellPath: "/bin/sh", shellScript: "/usr/local/bin/carthage copy-frameworks\n")
                addObject(carthageScript)
                buildPhases.append(carthageScript.reference)
