1Swift parses .pc files manually, but this means it bypasses our pkg-config
2wrapper. That wrapper normally takes care of introducing the correct
3PKG_CONFIG_PATH for cross compiling.
4
5--- a/Sources/PackageLoading/PkgConfig.swift
6+++ b/Sources/PackageLoading/PkgConfig.swift
7@@ -123,14 +123,17 @@ public struct PkgConfig {
8
9 private static var envSearchPaths: [AbsolutePath] {
10 get throws {
11- if let configPath = ProcessEnv.vars["PKG_CONFIG_PATH"] {
12+ var result: [AbsolutePath] = []
13+ for envVar in ["PKG_CONFIG_PATH", "PKG_CONFIG_PATH_FOR_TARGET"] {
14+ if let configPath = ProcessEnv.vars[envVar] {
15 #if os(Windows)
16- return try configPath.split(separator: ";").map({ try AbsolutePath(validating: String($0)) })
17+ result += try configPath.split(separator: ";").map({ try AbsolutePath(validating: String($0)) })
18 #else
19- return try configPath.split(separator: ":").map({ try AbsolutePath(validating: String($0)) })
20+ result += try configPath.split(separator: ":").map({ try AbsolutePath(validating: String($0)) })
21 #endif
22 }
23- return []
24+ }
25+ return result
26 }
27 }
28 }