Skip to content

Conversation

@bjoo
Copy link

@bjoo bjoo commented Dec 15, 2025

OK it turns out LLVM's LLVMConfigVersion.cmake seems to not support range based searches. This PR gets around this by finding any available LLVM and then just comparing the major version.

The problem: suppose we want to find LLVM version X.Y.Z or more recent and we issue
find_package(LLVM X.Y.Z). We have LLVM version P.Q.R on the CMAKE prefix Path.
The find_package() will only succeed if: X=P, Y=Z and R>=Z. It will not succeed for a range or a minor version difference. This is strict and it cannot acommodate a change going e.g. to the top of the release-20.x branch when asking for version 20.

The workaround here is to just ask to find any LLVM and check the major number post-facto:

find_package(LLVM CONFIG REQUIRED) # Generic find
if( ${LLVM_VERSION_MAJOR} EQUAL ... ) # We can process just major version equality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant