Having used CMake, I've become used to out-of-source builds, which are encouraged with CMake. How can out-of-source builds be done with Cargo?
Using in-source-builds again feels like a step backwards:
- Development tools need to be configured to ignore paths. Sometimes multiple plugins and development tools - especially using VIM or Emacs!
- Some tools can't be configured to easily hide build files. While dotfiles are typically hidden, they will still show
Cargo.lock
andtarget/
, worse still, recursively exposing their contents. - Deleting un-tracked files to remove everything outside of version control, typically to cleanup editor temp files or some test output, can backfire if you forgot to add a new file to version control and don't manually check the file list properly before deleting them.
- Dependencies are downloaded into your source code path, sometimes adding
*.rs
files in thetarget
directory as part of building indirect deps, so operating on all*.rs
files may accidentally pickup other files which aren't in a hidden directory, so might not be ignored even after development tools have been configured.
While it's possible to work around all these issues, I'd rather just have an external build path and keep the source directory pristine.