Skip to content

Commit 0a3f3de

Browse files
committed
build: depend on all cargo outputs in custom target
The custom target driving the cargo build depended only on LIB_FILE (the main library), not LIB_OUTPUTS (which also includes the import library on Windows for cdylib builds). If the import library was missing or stale but the DLL existed, CMake would consider the target up-to-date and skip the cargo invocation, causing link failures. Use LIB_OUTPUTS so the target depends on all expected artifacts.
1 parent 11958a4 commit 0a3f3de

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cmake/CMakeCargo.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function(cargo_build)
246246
COMMENT "running cargo rustc --crate-type ${CARGO_CRATE_TYPE}"
247247
)
248248

249-
add_custom_target(${CARGO_NAME}_${CARGO_CRATE_TYPE}_target ALL DEPENDS ${LIB_FILE})
249+
add_custom_target(${CARGO_NAME}_${CARGO_CRATE_TYPE}_target ALL DEPENDS ${LIB_OUTPUTS})
250250

251251
if(CARGO_CRATE_TYPE STREQUAL "staticlib")
252252
add_library(${CARGO_NAME}_${CARGO_CRATE_TYPE} STATIC IMPORTED GLOBAL)

0 commit comments

Comments
 (0)