Have cargo print the name of the final generated executable, maybe through modifying build.rs?

13 Views Asked by At

I run cargo b and cargo r from different environments (including command line and emacs in server or stand-alone configuration). An issue I regularly experience is that I then would like to run the generated program "manually", for example to test command-line options in a different context. However, sometimes the executable was not where I expected it (because, for example, emacs when started as daemon "saw" a different "CARGO_TARGET_DIR"). Also, for embedded projects I sometimes have profiles other that debug and release.

I understand I can run cargo metadata and extract some of the info from there, but this fails if cargo is started from an IDE such as emacs/rustic-mode. Of course I can start to hack the emacs config, but I would like to avoid that if possible.

Is it possible to use build.rs to have cargo display the full path of the executable produced, ideally at the end of the build process? How can I achieve that

0

There are 0 best solutions below