# Fetch Content EXCLUDE\_FROM\_ALL still adds targets to Xcode IDE

**URL:** https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841
**Category:** Usage
**Tags:** os:macos, gen:xcode
**Created:** [March 27, 2025, 5:11pm UTC](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841 "2025-03-27T17:11:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![K20shores](https://discourse.cmake.org/user_avatar/discourse.cmake.org/k20shores/32/2987_2.png) [@K20shores](https://discourse.cmake.org/u/K20shores)
#### Post date: [March 27, 2025, 5:11pm UTC](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841/1 "2025-03-27T17:11:40Z")

</div>

Below is a minimal cmake file that includes eigen with fetch content.

```auto
cmake_minimum_required(VERSION 3.28)
project(EigenFetchExample LANGUAGES CXX)

include(FetchContent)

FetchContent_Declare(
    eigen
    GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
    GIT_TAG 3.4.0
    EXCLUDE_FROM_ALL
)

set(BUILD_TESTING OFF CACHE BOOL "" FORCE)

FetchContent_MakeAvailable(eigen)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE Eigen3::Eigen)

```

When I generate an Xcode project, many of the eigen targets still show up in the Xcode IDE even though I specify `EXCLUDE_FROM_ALL`

```auto
mkdir build && cd build
cmake -G Xcode ..

```

I thought `EXCLUDE_FROM_ALL` was meant to prevent this from happening. What am I missing?

 ![Screenshot 2025-03-27 at 12.11.55 PM](https://discourse.cmake.org/uploads/default/original/2X/2/2d1ba021a16d568950b2db39483892671a16ada7.png)

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [March 27, 2025, 10:27pm UTC](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841/2 "2025-03-27T22:27:24Z")

</div>

You are misunderstanding what EXCLUDE\_FROM\_ALL does. The dependency is still added to the build, and the same targets are all still defined. When EXCLUDE\_FROM\_ALL is given, all it means is don’t _build_ the dependency’s targets as part of the default ALL target. They are still defined and can be manually built, hence why they still show up in your IDE.

---

<div class="post-metadata">

### Author: ![K20shores](https://discourse.cmake.org/user_avatar/discourse.cmake.org/k20shores/32/2987_2.png) [@K20shores](https://discourse.cmake.org/u/K20shores)
#### Post date: [March 28, 2025, 1:17pm UTC](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841/3 "2025-03-28T13:17:12Z")

</div>

@craig.scott ah, I see I’m mistaken now. Thanks for the reply. Do you happen to know if there is a way to include a project with fetch content without having its targets added to an IDE project?

---

<div class="post-metadata">

### Author: ![K20shores](https://discourse.cmake.org/user_avatar/discourse.cmake.org/k20shores/32/2987_2.png) [@K20shores](https://discourse.cmake.org/u/K20shores)
#### Post date: [March 28, 2025, 4:28pm UTC](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841/4 "2025-03-28T16:28:10Z")

</div>

Well, I suppose the best case is to hope that it can be found with FIND\_PACKAGE and use the [FIND\_PACKAGE\_ARGS](https://cmake.org/cmake/help/latest/module/FetchContent.html#integrating-with-find-package) functionality.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [March 28, 2025, 11:23pm UTC](https://discourse.cmake.org/t/fetch-content-exclude-from-all-still-adds-targets-to-xcode-ide/13841/5 "2025-03-28T23:23:06Z")

</div>

> [@K20shores](#):
>
> Do you happen to know if there is a way to include a project with fetch content without having its targets added to an IDE project?

Not that I’m aware of. CMake doesn’t have any mechanism to say “treat this target as internal, don’t show it in IDEs”. Some related discussion can be found in [this feature request](https://gitlab.kitware.com/cmake/cmake/-/issues/23566).
