You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most CMake configurations use the ON|OFF convention to indicate a boolean value. It would be more ergonomic to add a new setter like fn define_bool(&mut self, key: &str, value: bool). Some build.rs scripts could also compute these values during execution, so having this function would simplify
cfg.define("SOMETHING",if flag {"ON"}else{"OFF"});
into
cfg.define_bool("SOMETHING", flag);
Workaround
Without this, I had to add this to all projects that needed this functionality:
traitCfgBool{fndefine_bool(&mutself,key:&str,value:bool);}implCfgBoolfor cmake::Config{fndefine_bool(&mutself,key:&str,value:bool){self.define(key,if value {"ON"}else{"OFF"});}}