Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add define_bool convention method #237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nyurik
Copy link

@nyurik nyurik commented Feb 9, 2025

Implements #236

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant