Skip to content

Commit

Permalink
Check flag support before adding
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Oct 10, 2024
1 parent e9e6e22 commit d4a29c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions aws-lc-fips-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ bindgen = ["dep:bindgen"] # Generate the bindings on the targetted platform as a
cmake = "0.1.48"
dunce = "1.0"
fs_extra = "1.3"
cc = "1.0.100"

[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos"), any(target_env = "gnu", target_env = "musl", target_env = "")))'.build-dependencies]
bindgen = { version = "0.69.2", optional = true }
Expand Down
14 changes: 10 additions & 4 deletions aws-lc-fips-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,16 @@ impl CmakeBuilder {
} else {
cmake_cfg.define("CMAKE_BUILD_TYPE", "release");
if target_family() == "unix" || target_env() == "gnu" {
cmake_cfg.cflag(format!(
"-ffile-prefix-map={}=",
self.manifest_dir.display()
));
let build = cc::Build::new();
let flag = format!("-ffile-prefix-map={}=", self.manifest_dir.display());
if let Ok(true) = build.is_flag_supported(&flag) {
cmake_cfg.cflag(flag);
} else {
let flag = format!("-fdebug-prefix-map={}=", self.manifest_dir.display());
if let Ok(true) = build.is_flag_supported(&flag) {
cmake_cfg.cflag(flag);
}
}
}
}
} else if target_os() == "windows" {
Expand Down

0 comments on commit d4a29c8

Please sign in to comment.