# How to get errors from 'install' command?

**URL:** <https://discourse.cmake.org/t/how-to-get-errors-from-install-command/956>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [April 8, 2020, 9:55pm UTC](https://discourse.cmake.org/t/how-to-get-errors-from-install-command/956 "2020-04-08T21:55:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeAB](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/9fc29f/32.png) [@JoeAB](https://discourse.cmake.org/u/JoeAB)\
**Post date:** [April 8, 2020, 9:55pm UTC](https://discourse.cmake.org/t/how-to-get-errors-from-install-command/956/1 "2020-04-08T21:55:42Z")

</div>

I want to copy a directory tree full of web files. It sounds as simple as

```auto
install(DIRECTORY mydir/ DESTINATION dir/elsewhere)

```

but it just not create a directory, copy any files or give an error or warning. How do I get a failed result?

---

<div class="post-metadata">

**Author:** ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)\
**Post date:** [April 9, 2020, 7:00am UTC](https://discourse.cmake.org/t/how-to-get-errors-from-install-command/956/2 "2020-04-09T07:00:37Z")

</div>

When do you want this copying to happen? If it’s at the time CMake is running, you want `file(COPY)`, not `install()`. The commands `install()` create rules for installing the project, which happens later at build time, when you run `make install` (or equivalent for other generators).

---

<div class="post-metadata">

**Author:** ![ferdnyc](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ferdnyc/32/267_2.png) [@ferdnyc](https://discourse.cmake.org/u/ferdnyc)\
**Post date:** [April 9, 2020, 7:47am UTC](https://discourse.cmake.org/t/how-to-get-errors-from-install-command/956/3 "2020-04-09T07:47:15Z")

</div>

Also, when using `install([FILES|DIRECTORY|TARGETS|etc.] ...)`, be aware that `DESTINATION` arguments are relative to the path specified in the `CMAKE_INSTALL_PREFIX` variable, not the current directory.

[`CMAKE_INSTALL_PREFIX`](https://cmake.org/cmake/help/v3.17/variable/CMAKE_INSTALL_PREFIX.html#variable:CMAKE_INSTALL_PREFIX) …

> defaults to `/usr/local` on UNIX and `c:/Program Files/${PROJECT_NAME}` on Windows.
