# Error in generated cmake\_install.cmake?

**URL:** https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827
**Category:** Usage
**Created:** [June 8, 2022, 8:07pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827 "2022-06-08T20:07:50Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 8, 2022, 8:07pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/1 "2022-06-08T20:07:50Z")

</div>

using **cmake version 3.23.2** on OSX I get the following error when I try to install **boost** from source:

```bash
bash-3.2$ ninja install
[0/2] Re-checking globbed directories...
[0/1] Install the project...
-- Install configuration: "Debug"
CMake Error at cmake_install.cmake:46 (file):
  file INSTALL cannot find
  "/Users/clausklein/.cache/CPM/boost_1_79_0/libs/accumulators/include": No
  such file or directory.

FAILED: CMakeFiles/install.util 
cd /Users/clausklein/.cache/CPM/boost_1_79_0/cmake-build-boost_1_79_0-x86_64-Debug/install && /usr/local/Cellar/cmake/3.23.2/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
bash-3.2$ 

```

the contents of `cmake_install.cmake:46` is

```cmake
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include" TYPE DIRECTORY FILES "/Users/clausklein/.cache/CPM/boost_1_79_0/libs/circular_buffer/include/")
endif()

```

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 8, 2022, 8:15pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/2 "2022-06-08T20:15:57Z")

</div>

@pdimov why try to install so many non existing **boost** `include directories`?

```bash
bash-3.2$ ninja rebuild_cache 
[0/2] Re-checking globbed directories...
[0/1] Running CMake to regenerate build system...
-- /usr/local/bin/ccache found and enabled
-- Boost: using system layout: include, bin, lib, lib/cmake
-- Boost: Debug build, shared libraries, MPI OFF, Python OFF, testing 1
CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/accumulators/include does
  not exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/algorithm/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/align/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/any/include does not exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/array/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/asio/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/assert/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/assign/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/atomic/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/beast/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/bimap/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/bind/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/callable_traits/include does
  not exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/chrono/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/circular_buffer/include does
  not exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/compatibility/include does
  not exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/compute/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/concept_check/include does
  not exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/config/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/container/include does not
  exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

CMake Warning at tools/cmake/include/BoostInstall.cmake:446 (message):
  /Users/clausklein/.cache/CPM/boost_1_79_0/libs/container_hash/include does
  not exists!
Call Stack (most recent call first):
  tools/cmake/include/BoostRoot.cmake:153 (boost_install)
  tools/cmake/include/BoostRoot.cmake:277 (__boost_auto_install)
  CMakeLists.txt:76 (include)

-- Boost.Context: architecture x86_64, binary format mach-o, ABI sysv, assembler gas, suffix .S, implementation fcontext
# ...

```

---

<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: [June 8, 2022, 8:16pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/3 "2022-06-08T20:16:42Z")

</div>

Does that path actually exist? Is your build directory actually under `.cache/CPM`?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 8, 2022, 8:43pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/4 "2022-06-08T20:43:51Z")

</div>

> [@ClausKlein](#):
>
> `/Users/clausklein/.cache/CPM/boost_1_79_0/cmake-build-boost_1_79_0-x86_64-Debug/install`

is my build dir.

And the `/Users/clausklein/.cache/CPM/boost_1_79_0/libs/accumulators/include` does not exist.

---

<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: [June 8, 2022, 9:14pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/5 "2022-06-08T21:14:47Z")

</div>

It sounds like a problem with the Boost build then. Why is it trying to install directories that it does not create?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 8, 2022, 9:23pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/6 "2022-06-08T21:23:01Z")

</div>

Yes, but my main question is: why is this `file(INSTALL ...)` with undocumented options used?

---

<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: [June 8, 2022, 9:30pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/7 "2022-06-08T21:30:54Z")

</div>

It is generated by CMake itself; it uses these undocumented options to implement other things.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 8, 2022, 9:45pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/8 "2022-06-08T21:45:39Z")

</div>

OK, but if I change the [BoostInstall.cmake](https://github.com/boostorg/cmake/blob/bd981bfaff20ae4275ecbeba711c90e7fc9d0316/include/BoostInstall.cmake#L446) module to use **FILES\_MATCHING** rules:

```cmake
  if(__HEADER_DIRECTORY AND NOT CMAKE_SKIP_INSTALL_RULES)

    if(NOT EXISTS "${__HEADER_DIRECTORY}")
      message(WARNING "${__HEADER_DIRECTORY} does not exists!")
    endif()

    get_filename_component( __HEADER_DIRECTORY "${__ HEADER_DIRECTORY}" ABSOLUTE)
    install(DIRECTORY "${__HEADER_DIRECTORY}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING REGEX ".*\.(inc|hpp|ipp|h)$")

  endif()

```

## it works without an error, even if the directory does not exist?

---

<div class="post-metadata">

### Author: ![pdimov](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pdimov/32/1520_2.png) [@pdimov](https://discourse.cmake.org/u/pdimov)
#### Post date: [June 8, 2022, 11:04pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/9 "2022-06-08T23:04:42Z")

</div>

How exactly are you trying to use Boost? I can see that you’re using CPM. One possible cause of these issues would be if you were trying to use a Boost release archive, in which these directories don’t exist. You need to use a git clone.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 9, 2022, 3:52am UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/10 "2022-06-09T03:52:18Z")

</div>

I use the `Boost release archive`.  
**If I clone the git repo it works better, but every lib is build**. This takes too long time (about 8 min) if I need only one.  
**Note** : most of the Boost libs may be used as `header only` libraries.  
see [use boost-cmake again by ClausKlein · Pull Request #359 · cpm-cmake/CPM.cmake · GitHub](https://github.com/cpm-cmake/CPM.cmake/pull/359/files#diff-d3ae1589d40e640844fbb97f9b0d363b44ad4bb709b78dc2647a048051b251ae)  
and [Actions · cpm-cmake/CPM.cmake · GitHub](https://github.com/cpm-cmake/CPM.cmake/actions/workflows/examples.yml)

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 9, 2022, 4:48am UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/11 "2022-06-09T04:48:45Z")

</div>

@pdimov I see, the `Boost tar archive` has a different directory structure and some files like `/CMakeLists.txt` are missing too.

---

<div class="post-metadata">

### Author: ![pdimov](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pdimov/32/1520_2.png) [@pdimov](https://discourse.cmake.org/u/pdimov)
#### Post date: [June 9, 2022, 1:07pm UTC](https://discourse.cmake.org/t/error-in-generated-cmake-install-cmake/5827/12 "2022-06-09T13:07:31Z")

</div>

To prevent all the Boost libraries from being built, you need to pass `EXCLUDE_FROM_ALL` to the `add_subdirectory` call for Boost.

Boost also supports a library filter; set `BOOST_INCLUDE_LIBRARIES` to a list of libraries before issuing `add_subdirectory` and only the listed libraries will be configured.
