# the amount of project() statements

**URL:** https://discourse.cmake.org/t/the-amount-of-project-statements/406
**Category:** Usage
**Created:** [December 17, 2019, 10:31pm UTC](https://discourse.cmake.org/t/the-amount-of-project-statements/406 "2019-12-17T22:31:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lieven](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/c37758/32.png) [@Lieven](https://discourse.cmake.org/u/Lieven)
#### Post date: [December 17, 2019, 10:31pm UTC](https://discourse.cmake.org/t/the-amount-of-project-statements/406/1 "2019-12-17T22:31:47Z")

</div>

Consider the following situation :  
A code base consisting out of:

- many libraries
- many applications/executables

Assume organized like this

> 

rootdir  
|—executables  
|—libraries

Where the executables contains a sub directory per application, and the libraries contains per directory a library (could be further divided in more hierarchical directories)  
Every directory has a CMakeLists.txt, add\_subdirectory() it child directories, until you reach a library directory (so no more hierarchical directories) which then does an add\_library()  
similar for the executables, bu tin the end they do an add\_executable()

What would be the adviced amount of project() 's ?  
Could it be a project per directory and per executable, of just 1 project at the top level, and consider the entire code base as the project out of which many executables and/or libraries could be built ?

kind regards

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [December 18, 2019, 3:35pm UTC](https://discourse.cmake.org/t/the-amount-of-project-statements/406/2 "2019-12-18T15:35:49Z")

</div>

> [@Lieven](#):
>
> of just 1 project at the top level, and consider the entire code base as the project out of which many executables and/or libraries could be built ?

Typically, yes. You would normally only use multiple `project()`s if your top-level project was using `add_subdirectory()` to add a project made by a third party (or one made by you but that lives in its own code base.)

Basically, if the subdirectories are grouped into a single coherent codebase then you would only have a single top-level project.
