From e2af87f7470bfc83f30a9dc83ccea12617b1d833 Mon Sep 17 00:00:00 2001 From: Christopher Gundler Date: Mon, 27 Sep 2021 15:01:48 +0200 Subject: [PATCH] Allow static linking against the VC runtime --- libsqlite3-sys/build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libsqlite3-sys/build.rs b/libsqlite3-sys/build.rs index fc3ac15..d6b2b7e 100644 --- a/libsqlite3-sys/build.rs +++ b/libsqlite3-sys/build.rs @@ -221,6 +221,11 @@ mod build_bundled { cfg.flag("-fsanitize=address"); } + // If explicitly requested: enable static linking against the Microsoft Visual C++ Runtime to avoid dependencies on vcruntime140.dll and similar libraries. + if cfg!(target_feature = "crt-static") && is_compiler("msvc") { + cfg.static_crt(true); + } + // Older versions of visual studio don't support c99 (including isnan), which // causes a build failure when the linker fails to find the `isnan` // function. `sqlite` provides its own implementation, using the fact