Scoped Subdirectories

Let's get introduced to the subdirectories and their scope in CMake.

It's a common practice to structure our project following the natural structure of the filesystem, where nested directories represent the discrete elements of the application: the business logic, GUI, API, and reporting, and finally, separate directories with tests, external dependencies, scripts, and documentation.

The add_subdirectory() command

To support this concept, CMake offers the following command:

Get hands-on with 1400+ tech skills courses.