Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Resolve symlink when finding install prefix #124743

Merged
merged 1 commit into from
Mar 18, 2025

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Jan 28, 2025

When determining the install prefix in LLVMConfig.cmake etc resolve symlinks in CMAKE_CURRENT_LIST_FILE first. The motivation for this is to support symlinks like /usr/lib64/cmake/llvm to /usr/lib64/llvm19/lib/cmake/llvm. This only works correctly if the paths are relative to the resolved symlink.

It's worth noting that this mostly already works out of the box, because cmake automatically does the symlink resolution when the library is found via CMAKE_PREFIX_PATH. It just doesn't happen when it's found via the default prefix path.

When determining the install prefix in LLVMConfig.cmake etc resolve
symlinks in CMAKE_CURRENT_LIST_FILE first. The motivation for this
is to support symlinks like `/usr/lib64/cmake/llvm` to
`/usr/lib64/llvm19/lib/cmake/llvm`. This only works correctly if
the paths are relative to the resolved symlink.

It's worth noting that this *mostly* already works out of the box,
because cmake automatically does the symlink resolution when the
library is found via CMAKE_PREFIX_PATH. It just doesn't happen
when it's found via the default prefix path.
@nikic nikic requested review from petrhosek and llvm-beanz January 28, 2025 13:30
@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Jan 28, 2025
@nikic
Copy link
Contributor Author

nikic commented Feb 11, 2025

Ping

@nikic nikic merged commit 2fbfbf4 into llvm:main Mar 18, 2025
77 checks passed
@nikic nikic deleted the cmake-config-symlink branch March 18, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants