Issue 179102
Summary Fix CMake install absolute path to support --prefix option
Labels new issue
Assignees
Reporter x12301450
    In the line 898 of [libc/include/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/main/libc/include/CMakeLists.txt), the variable `install_dir` is set to be absolute. And then it is used as the install destination in line 901.

```
set(install_dir ${CMAKE_INSTALL_PREFIX}/${resource_dir}/llvm_libc_wrappers/${nested_dir})
install(FILES ${decls_file}
          DESTINATION ${install_dir}
          COMPONENT libc-headers)
```

However, when attempting to use the --prefix option to relocate the installation destination, using an absolute path causes the installation to fail. This prevents the installation to custom prefixes and could lead to unintended issues. CMake also recommends using realtive path in `install(destination)`.

There are numerous similar fixes, such as this [example](https://github.com/rose-compiler/rose/commit/82ea6ae677a29fdab89b063073261a08be9387d4).

I think the variable `install_dir` should be set to a relative path, excluding `${CMAKE_INSTALL_PREFIX}`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to