Error in generated cmake_install.cmake?

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

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

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()

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

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
# ...

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

is my build dir.

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

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

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

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

OK, but if I change the BoostInstall.cmake module to use FILES_MATCHING rules:

  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?

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.

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
and Actions · cpm-cmake/CPM.cmake · GitHub

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

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.

1 Like