Skip to content

Commit 21cc839

Browse files
committed
Windows treat link warnings as error
1 parent cc75014 commit 21cc839

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/cross.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ jobs:
116116
cargo-xwin:
117117
if: github.repository_owner == 'aws'
118118
runs-on: ubuntu-latest
119+
env:
120+
RUSTFLAGS: '-Clink-arg= /WX'
119121
steps:
120122
- name: Install build dependencies
121123
run: |
@@ -142,6 +144,8 @@ jobs:
142144
if: github.repository_owner == 'aws'
143145
name: ${{ matrix.target }}
144146
runs-on: windows-latest
147+
env:
148+
RUSTFLAGS: '-Clink-arg= /WX'
145149
strategy:
146150
fail-fast: false
147151
matrix:
@@ -180,6 +184,8 @@ jobs:
180184
if: github.repository_owner == 'aws'
181185
name: aarch64-pc-windows-msvc
182186
runs-on: windows-latest
187+
env:
188+
RUSTFLAGS: '-Clink-arg= /WX'
183189
steps:
184190
- uses: actions/checkout@v3
185191
with:

aws-lc-sys/builder/cmake_builder.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,16 @@ impl CmakeBuilder {
6868

6969
fn get_cmake_config(&self) -> cmake::Config {
7070
let mut cmake_cfg = cmake::Config::new(&self.manifest_dir);
71-
// See issue: https://github.com/aws/aws-lc-rs/issues/453
72-
cmake_cfg.static_crt(true);
71+
if cargo_env("CARGO_ENCODED_RUSTFLAGS").contains("-Ctarget-feature=+crt-static") {
72+
// See issue: https://github.com/aws/aws-lc-rs/issues/453
73+
cmake_cfg.static_crt(true);
74+
}
7375
cmake_cfg
7476
}
7577

7678
#[allow(clippy::too_many_lines)]
7779
fn prepare_cmake_build(&self) -> cmake::Config {
7880
let mut cmake_cfg = self.get_cmake_config();
79-
8081
if OutputLibType::default() == OutputLibType::Dynamic {
8182
cmake_cfg.define("BUILD_SHARED_LIBS", "1");
8283
} else {
@@ -91,6 +92,7 @@ impl CmakeBuilder {
9192
cmake_cfg.define("CMAKE_BUILD_TYPE", "release");
9293
}
9394
} else if target_os() == "windows" {
95+
// See issue: https://github.com/aws/aws-lc-rs/issues/453
9496
cmake_cfg.define("CMAKE_BUILD_TYPE", "relwithdebinfo");
9597
} else {
9698
cmake_cfg.define("CMAKE_BUILD_TYPE", "debug");

0 commit comments

Comments
 (0)