Copy some file from a dependency crate build directory to the current crate build directory?

Hi!

Let me detail my problem:
I’m making a crate named cef-sys which aims to compile and provide the library and binding for Chromium Embedded Framework (CEF).
The source code of CEF is compiled using cmake and creates a libcef_dll_wrapper.a and a Chromium Embedded Framework.framework (I’m on osx).
On my bindings, I use #[link(name = "cef_dll_wrapper", kind = "static")] to link with the static library of CEF.
So far it’s ok. Then I have another crate cef-test which uses this cef-sys crate. It builds fine, but to make my final executable works, I need to copy Chromium Embedded Framework.framework from the OUT_DIR of my cef-sys crate to the OUT_DIR of my cef-test crate to have it next to the final binary.

You can try writing the path to the framework in a custom metadata key:

cef-sys build script stdout:

cargo:framework-path=path/to/framework

This metadata will be exposed to downstream buildscripts in an environment variable. (I think in this case DEP_CEF_FRAMEWORK_PATH)

It would work, but is the metadata supposed to be in environment variables?
I don’t see it when I do the following code in the build.rs of my cef-test crate:

use std::env;

fn main() {
    for (key, value) in env::vars() {
        println!("{}: {}", key, value);
    }
}

and the following code in the build.rs of the cef-sys crate:

    println!("cargo:myframework=test");

Ok, I got it. I had just forgotten to set links = "cef_dll_wrapper" in the Cargo.toml of cef-sys. The environment variable are not set if there is no links.
Then the environment variable have the name DEP_ + CEF_DLL_WRAPPER + _MYFRAMWORK.

Thank you @ExpHP