From 5cd9c033083c871ce4334c3bf5995afd1ab65e44 Mon Sep 17 00:00:00 2001 From: Alexander Rodin Date: Mon, 18 Nov 2019 10:26:14 +0300 Subject: [PATCH] Support CMake build on MSVC Signed-off-by: Alexander Rodin --- rdkafka-sys/build.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rdkafka-sys/build.rs b/rdkafka-sys/build.rs index 826402e73..d96a85f4a 100644 --- a/rdkafka-sys/build.rs +++ b/rdkafka-sys/build.rs @@ -167,6 +167,15 @@ fn build_librdkafka() { config.define("CMAKE_SYSTEM_NAME", system_name); } let dst = config.build(); + #[cfg(target_env = "msvc")] + { + let profile = match &env::var("PROFILE").expect("Cannot determine build profile")[..] { + "release" | "bench" => "Release", + _ => "Debug" + }; + println!("cargo:rustc-link-search=native={}/build/src/{}", dst.display(), profile); + } + #[cfg(not(target_env = "msvc"))] println!("cargo:rustc-link-search=native={}/build/src", dst.display()); println!("cargo:rustc-link-lib=static=rdkafka"); }