1message(STATUS "Adding rust ${CMAKE_CURRENT_LIST_DIR}/Cargo.toml") 2 3# This will automatically register all the tests as well. 4corrosion_import_crate(MANIFEST_PATH Cargo.toml FLAGS --offline --verbose) 5 6corrosion_set_env_vars(backend-proto 7 PROTOBUF_INCLUDE_DIR=${NATIVE_PROTOBUF_INCLUDE_DIR}) 8# Set CMake executable filepath because it's not found by cmake Rust crate. From 9# https://github.com/rust-lang/cmake-rs, the CMake executable is assumed to be 10# cmake unless the CMAKE environmental variable is set. 11corrosion_set_env_vars(backend-proto CMAKE=${CMAKE_COMMAND}) 12 13if(LINUX) 14 # b/260271048 15 corrosion_add_target_rustflags( 16 backend-proto "-Clink-args=-Wl,-rpath,${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") 17endif() 18