cmake-rs icon indicating copy to clipboard operation
cmake-rs copied to clipboard

don't re-build a unchanged cmake dependency

Open Licenser opened this issue 7 years ago • 5 comments

When compiling a project that has a cmake dependency it'll re-compile the dependency every time cargo is run.

Licenser avatar Oct 11 '18 11:10 Licenser

This crate already has some logic to avoid rebuilding too much, but it sounds like it's still happening for you? Can you post an example to poke around with?

alexcrichton avatar Oct 11 '18 19:10 alexcrichton

I'm having a similar issue. I'm not sure what exactly is getting rebuilt (is there any way to get more output from cmake-rs from cargo as opposed to just the progress bar?) but it's not the whole cmake project as that would take a really long time. My project is here: https://github.com/anderslanglands/oiio-rs

Changing anything in the rust part causes cmake to rebuild even though always_configure is false.

anderslanglands avatar Mar 10 '19 02:03 anderslanglands

Same here, I tried setting always_configure(false) but no effect, still rebuilds from scratch.

RReverser avatar Nov 27 '22 00:11 RReverser

For now used a workaround

let built_marker = out_dir.join(".built");

if !built_marker.exists() {
    cmake::/* ... */

    std::fs::File::create(built_marker).unwrap();
}

this will likely cause issues when some flags change, but at least avoids rebuilding the C++ dependency of my project all the time.

RReverser avatar Nov 27 '22 13:11 RReverser