# Question re. CMAKE\_BUILD\_WITH\_INSTALL\_RPATH

**URL:** https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568
**Category:** Code
**Created:** [February 13, 2025, 12:14am UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568 "2025-02-13T00:14:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![poldi](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/8baadc/32.png) [@poldi](https://discourse.cmake.org/u/poldi)
#### Post date: [February 13, 2025, 12:14am UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568/1 "2025-02-13T00:14:10Z")

</div>

I’m trying to build a product and am getting the following error

```auto
CMake Error at CMakeLists.txt:410 (add_executable):
[cmake] The install of the strawberry target requires changing an RPATH from the
[cmake] build tree, but this is not supported with the Ninja generator unless on an
[cmake] ELF-based or XCOFF-based platform. The CMAKE_BUILD_WITH_INSTALL_RPATH
[cmake] variable may be set to avoid this relinking step.

```

The Author pf the product doesn’t use Ninja, so he doesn’t know what the error means.  
Thanks

---

<div class="post-metadata">

### Author: ![poldi](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/8baadc/32.png) [@poldi](https://discourse.cmake.org/u/poldi)
#### Post date: [February 17, 2025, 6:20am UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568/2 "2025-02-17T06:20:07Z")

</div>

I’m trying to build this on Ubuntu 24.04.2 LTS with cmake version 3.28.3

---

<div class="post-metadata">

### Author: ![retif](https://discourse.cmake.org/user_avatar/discourse.cmake.org/retif/32/1776_2.png) [@retif](https://discourse.cmake.org/u/retif)
#### Post date: [February 17, 2025, 8:43am UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568/3 "2025-02-17T08:43:10Z")

</div>

> is not supported with the Ninja generator  
> …  
> The Author pf the product doesn’t use Ninja

So it means that you are using Ninja then, doesn’t it.

> install of the strawberry target requires changing an RPATH from the build tree  
> …  
> CMAKE\_BUILD\_WITH\_INSTALL\_RPATH variable may be set

So have you tried following that instruction? Since it is printed out, one should probably not ignore it.

---

<div class="post-metadata">

### Author: ![poldi](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/8baadc/32.png) [@poldi](https://discourse.cmake.org/u/poldi)
#### Post date: [February 17, 2025, 9:43pm UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568/4 "2025-02-17T21:43:52Z")

</div>

I have not set CMAKE\_BUILD\_WITH\_INSTALL\_RPATH as I don’t know what it should point to on Ubuntu 24.04.2 LTS

---

<div class="post-metadata">

### Author: ![retif](https://discourse.cmake.org/user_avatar/discourse.cmake.org/retif/32/1776_2.png) [@retif](https://discourse.cmake.org/u/retif)
#### Post date: [February 17, 2025, 10:00pm UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568/5 "2025-02-17T22:00:44Z")

</div>

Have you tried looking for it in [documentation](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_WITH_INSTALL_RPATH.html)?

---

<div class="post-metadata">

### Author: ![poldi](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/8baadc/32.png) [@poldi](https://discourse.cmake.org/u/poldi)
#### Post date: [February 17, 2025, 10:03pm UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568/6 "2025-02-17T22:03:59Z")

</div>

```auto
Use the install path for the RPATH.

Normally CMake uses the build tree for the RPATH when building executables etc on systems that use RPATH. When the software is installed the executables etc are relinked by CMake to have the install RPATH. If this variable is set to true then the software is always built with the install path for the RPATH and does not need to be relinked when installed.

This is used to initialize the BUILD_WITH_INSTALL_RPATH target property for all targets.

```

---

<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: [February 18, 2025, 9:18am UTC](https://discourse.cmake.org/t/question-re-cmake-build-with-install-rpath/13568/7 "2025-02-18T09:18:31Z")

</div>

If that doesn’t tell you enough, have you also tried following the link to the [`BUILD_WITH_INSTALL_RPATH` property docs](https://cmake.org/cmake/help/latest/prop_tgt/BUILD_WITH_INSTALL_RPATH.html#prop_tgt:BUILD_WITH_INSTALL_RPATH)?
