Skip to content

Commit 3a92abb

Browse files
committed
build: Don't build clap if we're being used as a library.
This works around rust-lang/cargo#1982 by using required-features.
1 parent a57d880 commit 3a92abb

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

Cargo.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ path = "src/lib.rs"
3333
name = "bindgen"
3434
path = "src/main.rs"
3535
doc = false
36+
required-features = ["binaries"]
3637

3738
[dev-dependencies]
3839
diff = "0.1"
@@ -42,8 +43,7 @@ shlex = "0.1"
4243
[dependencies]
4344
cexpr = "0.2"
4445
cfg-if = "0.1.0"
45-
# This kinda sucks: https://github.com/rust-lang/cargo/issues/1982
46-
clap = "2"
46+
clap = { version = "2", optional = true }
4747
clang-sys = { version = "0.21.0", features = ["runtime", "clang_3_9"] }
4848
lazy_static = "0.2.1"
4949
peeking_take_while = "0.1.2"
@@ -60,6 +60,7 @@ optional = true
6060
version = "0.3"
6161

6262
[features]
63+
binaries = ["clap"]
6364
default = ["logging"]
6465
logging = ["env_logger", "log"]
6566
static = []

0 commit comments

Comments
 (0)