         return "\(carthagePath)/\(platformName)"
     }
 
-    func getCarthageFrameworks(target: Target) -> [String] {
-        var frameworks: [String] = []
+    func getAllCarthageDependencies(target: Target) -> [Dependency] {
+        var frameworks: [Dependency] = []
         for dependency in target.dependencies {
             switch dependency.type {
-            case .carthage: frameworks.append(dependency.reference)
+            case .carthage:
+                frameworks.append(dependency)
             case .target:
                 if let target = spec.getTarget(dependency.reference) {
-                    frameworks += getCarthageFrameworks(target: target)
+                    frameworks += getAllCarthageDependencies(target: target)
                 }
             default: break
             }

            buildPhases.append(copyFilesPhase.reference)
        }

        if !carthageFrameworks.isEmpty {

            if target.type.isApp && target.platform != .macOS {
                let inputPaths = carthageFrameworks.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)


    func generateTarget(_ target: Target) throws -> PBXNativeTarget {

        let carthageDependencies = getAllCarthageDependencies(target: target)

        let sourcePaths = target.sources.map { basePath + $0 }
        var sourceFilePaths: [Path] = []
