corrosion-rs / corrosion

Marrying Rust and CMake - Easy Rust and C/C++ Integration!
https://corrosion-rs.github.io/corrosion/
MIT License
1.07k stars 103 forks source link

corrosion_import_crate: issue with PROFILE argument in combination with CRATES #495

Closed Felix-El closed 6 months ago

Felix-El commented 6 months ago

I'm trying to invoke import like so:

corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_BINARY_DIR}/git/Cargo.toml
  PROFILE release
  CRATES my-crate
)

however I get:

`corrosion_import_crate()` was called with the `CRATES` parameter set to `my-cratePROFILErelease`.
Corrosion will only attempt to import packages matching names from this list.

It looks like the issue is with passing PROFILE argument to _generator_add_cargo_targets which does not seem to take such argument:

https://github.com/corrosion-rs/corrosion/blob/366066c9caed822a4cbfc2fafbf7d0116d59b832/cmake/Corrosion.cmake#L930-L939

With the forwarding removed it seems to work. Is it the right thing to do?