# Directly building in the install directory

**URL:** https://discourse.cmake.org/t/directly-building-in-the-install-directory/14238
**Category:** Usage
**Created:** [June 16, 2025, 9:25am UTC](https://discourse.cmake.org/t/directly-building-in-the-install-directory/14238 "2025-06-16T09:25:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [June 16, 2025, 9:25am UTC](https://discourse.cmake.org/t/directly-building-in-the-install-directory/14238/1 "2025-06-16T09:25:35Z")

</div>

What are the disadvantages of generating binaries (exe, lib) directly in their installation directory (using `<TARGET_TYPE>_OUTPUT_DIRECTORY`) rather than in the build directory and then copying them (in post-build or via the installation command)?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 16, 2025, 3:14pm UTC](https://discourse.cmake.org/t/directly-building-in-the-install-directory/14238/2 "2025-06-16T15:14:38Z")

</div>

A non-exhaustive list of things that come to mind:

- Inter-library paths may use absolute paths rather than relative paths (e.g., `$ORIGIN` or `@loader_path`)
- `export(EXPORT)` for the build tree writes absolute paths; `install(EXPORT)` write prefix-relative paths
- How/when do headers end up in the install tree? Any other necessary resources?
- Permission differences
- Do you trust the `clean` target?

I’m sure there are more.

---

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [July 1, 2025, 7:09am UTC](https://discourse.cmake.org/t/directly-building-in-the-install-directory/14238/3 "2025-07-01T07:09:46Z")

</div>

Thanks,

I’m working with a constraint architecture of directories thus, in my case, these are not concerns (yet I will double-check the 2 firsts and the last bullets).

But I understand that it matters for more classical projects ! Thanks again for these insights.

Regards  
A.
