```cmake
# Arguments:
#  PREFIX    - Installation prefix
#  COMPONENTS - Installation component

set(COMPONENTS ${COMPONENTS})
foreach(component ${COMPONENTS})
  execute_process(
    COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${PREFIX}
                             -DCMAKE_INSTALL_COMPONENT=${component}
                             -P cmake_install.cmake
    RESULT_VARIABLE result
    OUTPUT_QUIET
  )

  if(result)
    set(msg "Local installation of ${component} failed: ${result}\n")
    message(FATAL_ERROR "${msg}")
  endif()
endforeach()
```

Disable DESTDIR when moving the headers in the build area (fixes ROOT-6803)
user
```cmake
# Arguments:
#  PREFIX    - Installation prefix
#  COMPONENTS - Installation component

set(COMPONENTS ${COMPONENTS})
set(ENV{DESTDIR} "")
foreach(component ${COMPONENTS})
  execute_process(
    COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${PREFIX}
                             -DCMAKE_INSTALL_COMPONENT=${component}
                             -P cmake_install.cmake
    RESULT_VARIABLE result
    OUTPUT_QUIET
  )

  if(result)
    set(msg "Local installation of ${component} failed: ${result}\n")
    message(FATAL_ERROR "${msg}")
  endif()
endforeach()
```
assistant