dtolnay / cxx

Safe interop between Rust and C++
https://cxx.rs
Apache License 2.0
5.68k stars 320 forks source link

How to include C++ files whose directory is given by an environment variable? #1356

Closed lenianiva closed 2 weeks ago

lenianiva commented 2 weeks ago

For example, during code generation I want to generate a header something.h that is in ${CMAKE_CURRENT_BINARY_DIR}/include/, but this would not work:

         include!(concat!(env!("CMAKE_CURRENT_BINARY_DIR"), "/include/something.h"));

which gives the error:

error[cxxbridge]: expected "quoted/path/to" or <bracketed/path/to>
lenianiva commented 2 weeks ago

I found it. I should be using .include on cxx_build::bridge(). The concat! code was copied from bindgen