Closed jschwe closed 2 months ago
We ran into the same issue but worked around it by explicitly setting lib.name (https://github.com/slint-ui/slint/commit/eeb7bad4aeec0fcdef16d59f74467cf908c6af13 ).
But I guess it also ok to do a _ -> - transformation unconditionally in corrosion.
We ran into the same issue but worked around it by explicitly setting lib.name (https://github.com/slint-ui/slint/commit/eeb7bad4aeec0fcdef16d59f74467cf908c6af13 ).
Thanks - I updated the issue description, and included your commit as an example that other users could follow. If you have any suggestions to improve the issue description, feel free to edit the description.
But I guess it also ok to do a _ -> - transformation unconditionally in corrosion.
There are also crates which use _
in their package name, so such a transformation would break those users instead. I would just unconditionally transform -
to _
, so that corrosion matches cargos post 1.79 behavior.
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 https://github.com/rust-lang/cargo/pull/12783 fixing issue https://github.com/rust-lang/cargo/issues/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 https://github.com/slint-ui/slint/commit/eeb7bad4aeec0fcdef16d59f74467cf908c6af13 for an example fix, without updating corrosion.