Directly building in the install directory

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)?

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.

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.