Skip to content

Commit 45c0181

Browse files
committed
Properly format DEP_XXX_ROOT
When specifying a dependency on library "foo-bar" by calling `Config::register_dep`, the environment variable to read when setting `CMAKE_PREFIX_PATH` is `DEP_FOO_BAR_ROOT`. The previous version of `register_dep` would work only if passed "FOO_BAR". With this change, it also accepts the more natural library name, i.e. "foo-bar", and does the necessary formatting internally when deriving the environment variable name.
1 parent 2750291 commit 45c0181

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ impl Config {
297297
// Add all our dependencies to our cmake paths
298298
let mut cmake_prefix_path = Vec::new();
299299
for dep in &self.deps {
300+
let dep = dep.to_uppercase().replace('-', "_");
300301
if let Some(root) = env::var_os(&format!("DEP_{}_ROOT", dep)) {
301302
cmake_prefix_path.push(PathBuf::from(root));
302303
}

0 commit comments

Comments
 (0)