From eaa6cb1975f2a25790a048d0293c89acfdfef191 Mon Sep 17 00:00:00 2001 From: Lucas Dietrich Date: Fri, 22 Sep 2023 11:29:01 +0200 Subject: [PATCH] Introduce CMAKE_RS_SKIP_COMPILER_FLAG which remove use of CMAKE_C_COMPILER flag from cmake command * This changes is required in order to build paho-mqtt for armv7-a using Yocto Poky compiler. --- src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 24728ba..58d05d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,7 +60,9 @@ pub struct Config { path: PathBuf, generator: Option, generator_toolset: Option, - cflags: OsString, + + /// Doc + pub cflags: OsString, cxxflags: OsString, asmflags: OsString, defines: Vec<(OsString, OsString)>, @@ -762,7 +764,10 @@ impl Config { // Also specify this on Windows only if we use MSVC with Ninja, // as it's not needed for MSVC with Visual Studio generators and // for MinGW it doesn't really vary. - if !self.defined("CMAKE_TOOLCHAIN_FILE") + let skip_compiler_flag = + env::var("CMAKE_RS_SKIP_COMPILER_FLAG").ok() == Some("1".to_string()); + if !skip_compiler_flag + && !self.defined("CMAKE_TOOLCHAIN_FILE") && !self.defined(&tool_var) && (env::consts::FAMILY != "windows" || (msvc && is_ninja)) {