# Intended way to interface with external targets(?)

**URL:** <https://discourse.cmake.org/t/intended-way-to-interface-with-external-targets/1099>\
**Category:** Code\
**Created:** [April 25, 2020, 5:40am UTC](https://discourse.cmake.org/t/intended-way-to-interface-with-external-targets/1099 "2020-04-25T05:40:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![UebelAndre](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/u/85f322/32.png) [@UebelAndre](https://discourse.cmake.org/u/UebelAndre)\
**Post date:** [April 25, 2020, 5:40am UTC](https://discourse.cmake.org/t/intended-way-to-interface-with-external-targets/1099/1 "2020-04-25T05:40:20Z")

</div>

I have a project with a similar structure

```auto
├── external
│ ├── ext
│ ├── glew
│ └── opencv
└── src

```

And I’ve never felt like I correctly integrate CMake projects from my `external` directory with my source. I usually end up creating a separate project in the root of external that compiles everything with every possible variant. But this becomes troublesome and hard to maintain when I want to support multi configuration platforms and configurations for `BUILD_SHARED_LIBS` being both `ON` and `OFF`. This is also troublesome because most of my projects are cross platform. I don’t quite understand the use of [ExternalProject](https://cmake.org/cmake/help/latest/module/ExternalProject.html), I’ve read that you can refer to the targets with that external project(?). I know you can do this roughly through [add\_subdirectory](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) but comes with namespace issues. Ideally, I want to point my project at another CMake project and depend on the targets defined within it and not have to worry about clashing target names or rebuilding the entire world when I want to run clean builds of my own code. I feel like for how powerful CMake is there has to be something I’m just missing. Does anyone have any suggestions/tips?

---

<div class="post-metadata">

**Author:** ![UebelAndre](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/u/85f322/32.png) [@UebelAndre](https://discourse.cmake.org/u/UebelAndre)\
**Post date:** [June 3, 2020, 3:11pm UTC](https://discourse.cmake.org/t/intended-way-to-interface-with-external-targets/1099/2 "2020-06-03T15:11:35Z")

</div>

Shameless self bump
