mirror of
https://github.com/facebook/sapling.git
synced 2024-12-28 15:44:27 +03:00
cmake: update RustStaticLibrary.cmake to hook up cargo dependencies
Summary: Update `RustStaticLibrary.cmake` to let CMake know that running `cargo` will produce the Rust static library output. Without this CMake does not know how to correctly wire up dependencies for libraries. Previously the code used the `ALL` target to ensure that the Rust static library was built, but this did not ensure that it was built before executables that require it. Reviewed By: pkaush Differential Revision: D18588010 fbshipit-source-id: 1a1880993bdfa3fcb876a0f6507e5cddfea9b738
This commit is contained in:
parent
55d980ee42
commit
344661b651
@ -120,7 +120,7 @@ function(rust_static_library TARGET)
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
${cargo_target} ALL
|
||||
${cargo_target}
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" -E env
|
||||
"CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}"
|
||||
@ -128,6 +128,9 @@ function(rust_static_library TARGET)
|
||||
${cargo_cmd}
|
||||
COMMENT "Building Rust crate '${crate_name}'..."
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
BYPRODUCTS
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/debug/${staticlib_name}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/release/${staticlib_name}"
|
||||
)
|
||||
|
||||
add_library(${TARGET} INTERFACE)
|
||||
|
Loading…
Reference in New Issue
Block a user