<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60647>60647</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            cmake --install with custom prefix does not work
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Febbe
      </td>
    </tr>
</table>

<pre>
    When compiling llvm17 via 

```
cmake ../llvm -DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra -DLLVM_TARGETS_TO_BUILD=X86 --install-prefix=/home/<username>/git/llvm-project/build-install
cmake --build .
cmake --install .
```

Will fail with many errors like this:

```
CMake Error at bindings/ocaml/llvm/cmake_install.cmake:54 (file):
  file cannot create directory: /usr/lib/ocaml/llvm.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  bindings/ocaml/cmake_install.cmake:47 (include)
 cmake_install.cmake:79 (include)
```

The reason is, that `/usr` is used as hard coded prefix path, instead of `${CMAKE_INSTALL_PREFIX}`.
Replacing all `/usr` occurrences fixed the problem, but then the target ocaml_doc, required by the "install" target, was not build.
Building it extra, fixed it.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE2P4zYM_TXKhUjgyLE9OfiQLxfTZnYXM2l3b4EsMTY7spRK8nz8-0KO0-0MggUCxaIeyccnUsJ7agxiybI1y7YT0YfWurLCusZJbdV7-b1FA9J2Z9JkGtD6pZsX8EICWLJlyWpc82T8DVvZiWeE2YzxKjrAdLvf__Vw3H1Zrfe747fHr7_vNocnlm6lFqZh6Xr4nwZrtZ_iW3Di6nJYPf62OzwdD1-P6z_v91uWbn_c5TCdkvFBaD09OzzRG0u3jFet7ZDxiqWb3qMzokOW7hivGgojk-nZ2b9Rxm3dk1bXMP-nPZ0ORzD7aByRV_Onii_rd9IaToI0vFJooRPmHdA56zxoekYILXmWrn6h3OYhZttFHxABajKKTOMZr6wUnR7LYLwaaB1HUrNhx9JVtgDG706kkfHlf5kAogWkMMYGkA5FQFDkUAbr3lm6Asar3rsYnepPuWYAD-K9RjCI6hpPqI4M-eBEoBeEs6MX0tigH9XZRKWegpDPkU9nfQCHEk0AGU9O5Hz4yPBGpbdLXBQxJBmpezVUeQlwG1wsb4Fv3t2hRXAovDVAnvENhFYEiKCLNnkC5KH3qEB4aIVTIK1CBZcOhLMIbXSLFFAosKeL84IV683D6o_d8f7L02G13x-_Pe6q-x-s2LI8GfV6xLMWMg5YlOdDUitl7xwaiR5O9IYKQhsVt7XGLias-xBNZrAH4RoMMEh4VFZGgMN_enKooH4fMIzza9tzPnpE3KvwEBtkaP-R2Dp-R14UYBjMCLzQoDCbqDJVy3QpJljO8yJb3hV5mk3aMpsvCy5wkSglMzHPcIlZoookFSrLi6WYUMkTniZ8niRJUsyzWV6fiiyXmUqU4kpytkiwE6RnQw9a10zI-x7LPMkXxUSLGrW_vlquHGa77hvPFokmH_xPt0BBY_l5iof5lL0PtrteoLJ4qf_VuudJ73TZhnAe5pVXl1ek7euZtN3PKfz0pgwUYwsPLP8NAAD__yFcsDI">