# Issue Understanding the CPM

**URL:** https://discourse.cmake.org/t/issue-understanding-the-cpm/4543
**Category:** Usage
**Created:** [November 24, 2021, 9:32pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543 "2021-11-24T21:32:21Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mrmsdbdl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrmsdbdl/32/2686_2.png) [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)
#### Post date: [November 24, 2021, 9:32pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/1 "2021-11-24T21:32:21Z")

</div>

I am wondering if someone could help me understand an issue that I have with the CPM. I can integrated it, no problem. But for some reason, when I build my project. CPM starts to mix up everything. It creates a `lib`, and `bin` directory in my build directory and shuffles everything around. I don’t exactly know what happened that CPM doesn’t put things in their respected `-build`, `-install` folders anymore.

I should probably mention that I’m using the `ExternalPackage` as well, and direct them to the same `_deps` directory. But, I don’t think that should cause the problem. I feel that somehow, CPM triggers an install target for some reason! I do not yet have an install target yet.

Thanks for your help in advance!

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [November 24, 2021, 11:56pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/2 "2021-11-24T23:56:25Z")

</div>

Are you talking about this [CPM](https://github.com/cpm-cmake/CPM.cmake)?

---

<div class="post-metadata">

### Author: ![mrmsdbdl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrmsdbdl/32/2686_2.png) [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)
#### Post date: [November 25, 2021, 4:27am UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/3 "2021-11-25T04:27:48Z")

</div>

Yes! I should have perhaps mentioned it! 🤦🏻‍♂️

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [November 25, 2021, 11:55am UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/4 "2021-11-25T11:55:05Z")

</div>

Consider creating a issue/conversation on the CPM.cmake github repo. The maintainer is very friendly and has helped me in the past.

If you can though please try and create a [SSCCE](http://www.sscce.org/) since it’s really difficult give meaningful feedback/help without one.

---

<div class="post-metadata">

### Author: ![mrmsdbdl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrmsdbdl/32/2686_2.png) [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)
#### Post date: [November 25, 2021, 12:44pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/5 "2021-11-25T12:44:38Z")

</div>

Thanks, I have already asked it there, but I thought I will share it here maybe someone could help.

SSCCE is usually a good idea, and I usually do that in this forum, but I felt this should be self explanatory enough, which appears to be not. I see if I can put together something minimal! Thanks again! 🙂

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [November 25, 2021, 1:06pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/6 "2021-11-25T13:06:22Z")

</div>

Could you post the link to your question on the CPM GitHub?

---

<div class="post-metadata">

### Author: ![mrmsdbdl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrmsdbdl/32/2686_2.png) [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)
#### Post date: [November 25, 2021, 1:12pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/7 "2021-11-25T13:12:53Z")

</div>

Sure, [here](https://github.com/cpm-cmake/CPM.cmake/issues/299). I have added an piece of code to show what is happening and I may have found the issue but I don’t know how to solve it.

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [November 25, 2021, 3:30pm UTC](https://discourse.cmake.org/t/issue-understanding-the-cpm/4543/8 "2021-11-25T15:30:13Z")

</div>

> [@mrmsdbdl](#):
>
> CPM starts to mix up everything. It creates a `lib`, and `bin` directory in my build directory and shuffles everything around. I don’t exactly know what happened that CPM doesn’t put things in their respected `-build`, `-install` folders anymore.

I ended up tracking this down and it was an issue with the libraries CMake code assuming it was the top level project. Making it unfriendly to be consumed via add\_subdirectory

See here:

> <https://github.com/cpm-cmake/CPM.cmake/issues/299#issuecomment-979297915>
>
> I am wondering if someone could help me understand an issue that I have with the… CPM. I can integrated it, no problem. But for some reason, when I build my project. CPM starts to mix up everything. It creates a \`lib\`, and \`bin\` directory in my build directory and shuffles everything around. I don't exactly know what happened that CPM doesn't put things in their respected \`-build\`, \`-install\` folders anymore. 
> 
> I should probably mention that I'm using the \`ExternalPackage\` as well, and direct them to the same \`\_deps\` directory. But, I don't think that should cause the problem. I feel that somehow, CPM triggers an install target for some reason! I am not sure. 
> 
> Thanks for your help in advance!
