From 48331360d50c8056d6c3e532f032c10b7e22c964 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Sat, 11 Jan 2025 19:57:42 +0100 Subject: [PATCH] cbindgen: Fix adding header dependency on cargo-build If headers are generated with cbindgen, they should probably always be available if the rust crate is also available, so it makes sense to add a dependency. The changed line was supposed to already do exactly that, however interface targets are not actually built, so we need to directly depend on the cargo-build_ custom command that generates the Rust library. We already do this in other places, it was just overlooked here. --- cmake/Corrosion.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/Corrosion.cmake b/cmake/Corrosion.cmake index 796ea295..ab9f7638 100644 --- a/cmake/Corrosion.cmake +++ b/cmake/Corrosion.cmake @@ -2119,6 +2119,9 @@ function(corrosion_experimental_cbindgen) ) add_dependencies("_corrosion_cbindgen_${cbindgen_bindings_target}_bindings" "_corrosion_cbindgen_${cbindgen_bindings_target}_bindings_${header_identifier}") add_dependencies(${cbindgen_bindings_target} "_corrosion_cbindgen_${cbindgen_bindings_target}_bindings") + if(TARGET "${CCN_TARGET}") + add_dependencies(cargo-build_${CCN_TARGET} "_corrosion_cbindgen_${cbindgen_bindings_target}_bindings") + endif() endfunction() # Parse the version of a Rust package from it's package manifest (Cargo.toml)