# CMake manage multiple different projects

**URL:** https://discourse.cmake.org/t/cmake-manage-multiple-different-projects/8065
**Category:** Usage
**Tags:** os:linux
**Created:** [May 6, 2023, 9:12am UTC](https://discourse.cmake.org/t/cmake-manage-multiple-different-projects/8065 "2023-05-06T09:12:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![charlieye007](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@charlieye007](https://discourse.cmake.org/u/charlieye007)
#### Post date: [May 6, 2023, 9:12am UTC](https://discourse.cmake.org/t/cmake-manage-multiple-different-projects/8065/1 "2023-05-06T09:12:28Z")

</div>

Hello,

There are multiple independent projects, and i use CMake to build each project. (each projects has it’s config/build/install)  
Now I want to integrate all projects by using cmake and git submodules, there is a root CMakeLists.txt. I encountered following problems,

1. in different independent projects, there are many same var name, how can i configure them separately in root CMakeLists.txt
2. how can i manage each projects, add\_subdirectory()?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 8, 2023, 6:30pm UTC](https://discourse.cmake.org/t/cmake-manage-multiple-different-projects/8065/2 "2023-05-08T18:30:31Z")

</div>

For these kinds of setups, it is usually better to use a “superbuild” concept where you use the [`ExternalProject`](https://cmake.org/cmake/help/latest/module/ExternalProject.html) module to build the projects. Projects not set up to be used via `add_subdirectory` usually have many “barbs” which trip up “sibling” projects.

Cc: @craig.scott
