# Install everything \_but\_certain components

**URL:** https://discourse.cmake.org/t/install-everything-but-certain-components/6209
**Category:** Usage
**Tags:** tool:cmake
**Created:** [August 3, 2022, 1:03pm UTC](https://discourse.cmake.org/t/install-everything-but-certain-components/6209 "2022-08-03T13:03:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![minrk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/minrk/32/2648_2.png) [@minrk](https://discourse.cmake.org/u/minrk)
#### Post date: [August 3, 2022, 1:03pm UTC](https://discourse.cmake.org/t/install-everything-but-certain-components/6209/1 "2022-08-03T13:03:35Z")

</div>

I work on packaging for conda-forge, and we often want to separate multiple _outputs_ for one project (commonly separating a shared library and language bindings, but could be any reason to subset files into outputs).

This often amounts to running build once, then install specific components in multiple stages to easily track different subsets of files. However, one thing I haven’t figured out how to do easily: **install everything _except_ specified component(s)**.

Basically, I want the pattern:

```auto
cmake --install build --exclude-component some-component # artifact 1
cmake --install build --component some-component # artifact 2

```

but I haven’t been able to produce artifact 1 without patching the CMakeLists to add `EXCLUDE_FROM_ALL` to all the components I want to select separately. Is there a way to do this without patching upstream CMakeLists?

If I assume everything is in a component (not a safe assumption, I think), I could always do `--component` installs, but I don’t see a way to _discover_ what all the components are to produce the initial list. Does that command exist?

[this package](https://github.com/conda-forge/adios2-feedstock/pull/55) is an example of splitting a cmake build into components, where patching in EXCLUDE\_FROM\_ALL is used to get it to do what I want.

---

<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: [August 3, 2022, 4:00pm UTC](https://discourse.cmake.org/t/install-everything-but-certain-components/6209/2 "2022-08-03T16:00:53Z")

</div>

Components are kind of ad hoc and not centrally managed by CMake, so without that, knowing what kind of set we’re subtracting from is problematic. Of course, there could also be a `CMAKE_INSTALL_COMPONENT_EXCLUDE` variable that, if set and matches, then skips whatever it guards.

---

<div class="post-metadata">

### Author: ![minrk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/minrk/32/2648_2.png) [@minrk](https://discourse.cmake.org/u/minrk)
#### Post date: [August 5, 2022, 9:06am UTC](https://discourse.cmake.org/t/install-everything-but-certain-components/6209/3 "2022-08-05T09:06:25Z")

</div>

Thanks! Consider this a feature request for that `--exclude-component` variable, then.

---

<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: [August 5, 2022, 1:10pm UTC](https://discourse.cmake.org/t/install-everything-but-certain-components/6209/4 "2022-08-05T13:10:54Z")

</div>

Concrete feature requests are tracked in the [issue tracker](https://gitlab.kitware.com/cmake/cmake/-/issues).

---

<div class="post-metadata">

### Author: ![Mathieu\_Westphal](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathieu_westphal/32/133_2.png) [@Mathieu\_Westphal](https://discourse.cmake.org/u/Mathieu_Westphal)
#### Post date: [January 18, 2023, 10:23am UTC](https://discourse.cmake.org/t/install-everything-but-certain-components/6209/5 "2023-01-18T10:23:54Z")

</div>

It would also be nice to be able to install everything in one command, even what is EXCLUDE\_FROM\_ALL. I’ll open a issue.

---

<div class="post-metadata">

### Author: ![Mathieu\_Westphal](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathieu_westphal/32/133_2.png) [@Mathieu\_Westphal](https://discourse.cmake.org/u/Mathieu_Westphal)
#### Post date: [January 18, 2023, 10:30am UTC](https://discourse.cmake.org/t/install-everything-but-certain-components/6209/6 "2023-01-18T10:30:20Z")

</div>

[https://gitlab.kitware.com/cmake/cmake/-/issues/24335](https://gitlab.kitware.com/cmake/cmake/-/issues/24335)
