Skip to content

Commit 71804a3

Browse files
committed
Default the env_metadata build parameter to true
`pkg-config` depends on a variety of environment variables to inform itself on where to look information about the libraries requested. By default the crate has chosen to not inform `cargo` about these variables, leading to problems that usually arise from `cargo` having incomplete understanding of the dependency information. In particular, changing `PKG_CONFIG_PATH` variable would more likely than not fail to rebuild various dependencies that discover their linkage information via `pkg-config`. This behaviour is confusing. Developers will generally not fiddle with these environment variables however, leading to most of the crate ecosystem not setting `env_metadata` to `true`. This commit adjusts the default for `env_metadata` to `true` to achieve the "correct" behaviour in the typical case. This should not actively break any users and maybe only result in `cargo` rebuilding crates unnecessarily in very obscure corner cases.
1 parent ad42450 commit 71804a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl Config {
197197
print_system_cflags: true,
198198
print_system_libs: true,
199199
cargo_metadata: true,
200-
env_metadata: false,
200+
env_metadata: true,
201201
}
202202
}
203203

@@ -259,7 +259,7 @@ impl Config {
259259

260260
/// Define whether metadata should be emitted for cargo allowing to
261261
/// automatically rebuild when environment variables change. Defaults to
262-
/// `false`.
262+
/// `true`.
263263
pub fn env_metadata(&mut self, env_metadata: bool) -> &mut Config {
264264
self.env_metadata = env_metadata;
265265
self

0 commit comments

Comments
 (0)