Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
There are two broad types of build environments - in-source and out-of-source. "In-source" means the compiled files will appear in the same directory as source files. "Out-of-source" means there is...
#1: Initial revision
How to do "out-of-source" build properly with cmake?
There are two broad types of build environments - in-source and out-of-source. "In-source" means the compiled files will appear in the same directory as source files. "Out-of-source" means there is a dedicated directory for compilation results. It seems the latter one is more suitable for large projects, and it is also recommended by cmake.
Suppose my project contains several libraries, which have their own cmake fiels, `CMakeLists.txt`.
I have two options - store build results for the libraries in the directories where libraries are, or in the directory of the project I am building.
```
project
possible place to put build results for libA and libB
project_1.cpp
project_2.cpp
libA
possible place to put build results for libA
libA_1.cpp
libA_2.cpp
libB
possible place to put build results for libB
libB_1.cpp
libB_2.cpp
```
Is there an option which is preferred by cmake?
Are there any obscure considerations which make one or the other option preferable?
