[Question] How do I get information back from CMake after configuring a library?
I have a CMake library that conditionally adds link time dependencies based on the output of a check_cxx_source_compiles command. That's all fine when building a CMake project, but when building a Cargo library I need to add a line like this into build.rs:
println!("cargo:rustc-link-lib=framework=XXX");
To mimic the behaviour of the CMake library, I will need to somehow retrieve the value of the variable that is set by the check_cxx_source_compiles command. That might not be possible directly, but it should be possible determine the value by reading (in build.rs) the output of the CMake configure command.
Is there a way to go about doing that? Or more generally, does cmake-rs have a good way to get information back from CMake after the CMake library is configured?
Looks like this is the same problem I ran into here:
https://stackoverflow.com/questions/74851275/rust-cargo-cmake-integration-with-c-library-dependencies
As far as I can tell, this crate is currently only driving the configuration/building process, so it does not have access to any information like that.
I guess in the future, one can imagine parsing the cmake install-config (e.g., https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/How-to-create-a-ProjectConfig.cmake-file) but that is probably a massive undertaking