-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Breaking change to target names containing dashes with Rust 1.79 #501
Comments
We ran into the same issue but worked around it by explicitly setting lib.name (slint-ui/slint@eeb7bad ). But I guess it also ok to do a _ -> - transformation unconditionally in corrosion. |
Thanks - I updated the issue description, and included your commit as an example that other users could follow.
There are also crates which use |
Rust 1.79 and newer replace dashes with underscores in lib names. This can only happen when the lib name is inherited from the package name, since explicit lib names have never been allowed to use dashes. Since we import our CMake target names by using cargo metadata, we make the same change as cargo 1.79 does, but also for older Rust versions, so that Corrosion users can use the same CMake target name independent of the Rust version. Fixes corrosion-rs#501 (cherry-picked from f85b242)
Corrosion v0.5 and newer unconditionally replace dashes with underscores in library names, to match the behavior of Rust 1.79 and newer. |
cargo-metadata
output for target names changes with Rust 1.79 due to PR rust-lang/cargo#12783 fixing issue rust-lang/cargo#12780. (TLDR: dashes in target names are replaced with underscores starting with Rust 1.79)Users would notice this by receiving errors that CMake can't find Rust targets with dashes in the name anymore, e.g.:
Example of an affected Cargo.toml file:
With Rust 1.79, corrosion would now import a crate named
flags_lib
, i.e. the CMake target name changed.Affected crates
[lib]
sectionbin
crates are NOT affected.Solution / Required actions
[lib]
or[[bin]]
sections of theirCargo.toml
manifests, and use that name in their CMake code. (Note: Cargo already forbids dashes in lib and bin target names). You may refer to slint-ui/slint@eeb7bad for an example fix, without updating corrosion.The text was updated successfully, but these errors were encountered: