Reputation: 174
I did this in cxx:
fn main() {
cxx_build::bridge("src/main.rs")
.file("src/something.cc")
.flag_if_supported("-std=c++17")
.compile("my_demo");
}
I want to link something.cc with another C++ library, but still run everything on Rust. I thus want to call C++ code, from Rust, and still have it compiled and linked using Cargo. All the projects I find are the inverse: compiling rust from Cmake and using on C++.
So, how do I compile a cmake project from build.rs and link to something.cc?
Upvotes: 2
Views: 1282
Reputation: 6109
cxx
can work with Cargo and C++ build systems. autocxx
might also be useful.
Upvotes: 1