OutofSourceBuilds
Out-of-source builds, often written as out-of-tree builds, are a method of constructing software in a separate directory outside the source tree. The source tree remains pristine, while build outputs, intermediate files, and generated artifacts reside in the separate build directory. This approach is widely used in C and C++ projects but is supported by other languages and build systems as well.
To perform an out-of-source build, create a dedicated build directory outside the source tree, then invoke the
Benefits include keeping the source tree clean, enabling multiple independent builds (for example, Debug vs Release)
Challenges include occasional project-specific requirements for in-tree builds, potential complexities with path discovery and include or
Best practices involve adding the build directory to version control ignore lists, documenting the build steps