In my (primarily C++) development, I have long adhered to using out-of-source builds. That is, my source usually sits in a /project/src
directory and the builds live in a /project/build/bin/release
, /project/build/bin/debug
directories. I have done this because it keeps my source directories clean from intermediate files, I have one location for all of my binaries, packaging is easier, cleaning is easier, and version control is easier. (Did I miss anything?)
I am inheriting a (large) project now that uses in-source builds. What is the motivation for this type of structure and what are its advantages? (I am most concerned with engineering-level reasons vs. personal preference types of reasons.)
I was hoping Lakos' "Large-Scale C++ Software Design" would have weighed in on it, but I missed it if it did.
main.cpp
initially being in the top level of your project, it still creates a separate cmake build directory away from your source at that top level. I believe MSVS is similar to Clion in this regard as well.