Make sure that cmake generate build files in current dir#194
Conversation
tgross35
left a comment
There was a problem hiding this comment.
To be clear, the problem is that when you configure a probject with cmake-rs and then try to build/reconfigure via the cmake binary directly, it doesn't work?
This fix makes sense, but I think we should use an absolute path to avoid any possible problems related to the location of .. So two requested changes:
-
Set
-Bright after here, so we set both the CWD and the-BflagLine 585 in fd56c5a
-
A few lines up, change
let build = dst.join("build");to:let build_dir = dst.join("build"); let build_dir = build_dir.canonicalize().unwrap_or_else(|| build_dir.clone);
This is preexisting but makes sure we are avoiding relative links. (also make the var name more clear)
(sorry for the delay here, this crate doesn't have a lot of maintenance)
|
I wound up doing the second bit in #250, so all that's needed is for this to be updated to use |
3500856 to
a6eeb95
Compare
## 🤖 New release * `cmake`: 0.1.54 -> 0.1.55 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.1.55](v0.1.54...v0.1.55) - 2025-12-11 ### Other - Remove the `\\?\` prefix from paths ([#259](#259)) - Add Visual Studio 2026 support ([#255](#255)) - Make sure that cmake generate build files in current dir ([#194](#194)) - Set the MSRV to 1.65 and test this in CI - Canonicalize the build directory - Use `eprintln` instead to print the command running next ([#191](#191)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This should fix the
Error: could not load cacheBUG.If there are already generated build files in the project directory, then if you execute the command
cmake path/projectin$OUT_DIR/build, cmake will not generate new build files in the$OUT_DIR/builddirectory.So
-B .is needed. https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-BExample:
Infomation: