Skip to content

Commit 49ee6eb

Browse files
zerocom38dginev
authored andcommitted
always add libxml2 subdirectory to the include path, because this seems to be standard
1 parent f138ca7 commit 49ee6eb

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

build.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,19 @@ fn main() {
124124
mod vcpkg_dep {
125125
use crate::ProbedLib;
126126
pub fn vcpkg_find_libxml2() -> Option<ProbedLib> {
127-
if let Ok(mut metadata) = vcpkg::Config::new().find_package("libxml2") {
128-
if let Some(mut include_path) = metadata.include_paths.pop() {
129-
if include_path.join("libxml2").exists() {
130-
// libxml2 >= 2.14.5 is in a 'libxml2' subdirectory
131-
include_path = include_path.join("libxml2");
132-
}
133-
return Some(ProbedLib {
134-
version: vcpkg_version(),
135-
include_paths: vec![include_path],
127+
if let Ok(metadata) = vcpkg::Config::new().find_package("libxml2") {
128+
let include_paths = metadata
129+
.include_paths
130+
.into_iter()
131+
.fold(Vec::new(), |mut acc, p| {
132+
acc.push(p.join("libxml2"));
133+
acc.push(p);
134+
acc
136135
});
137-
}
136+
return Some(ProbedLib {
137+
version: vcpkg_version(),
138+
include_paths,
139+
});
138140
}
139141
None
140142
}

0 commit comments

Comments
 (0)