Skip to content

CMake fix for Mac building #1181

@MirceaS

Description

@MirceaS

When I try to build the LLVM backend on my M1 Mac I keep running into issues due to how CMake handles the versioning of LLVM.
In particular, the issue is with the lines below:

find_package(LLVM 18.1 QUIET CONFIG)
if (NOT LLVM_FOUND)
find_package(LLVM 17 QUIET CONFIG)
endif()
if (NOT LLVM_FOUND)
find_package(LLVM 16 QUIET CONFIG)
endif()
if (NOT LLVM_FOUND)
find_package(LLVM 15 QUIET CONFIG)
endif()

I have LLVM version 15.0.7 installed but for some reason this is not found by find_package(LLVM 15 QUIET CONFIG). I also tried to change it to find_package(LLVM 15...<16 QUIET CONFIG) but this also failed.
If I simply replace all of these lines by find_package(LLVM REQUIRED CONFIG) then everything works fine, so I would propose doing this change (I would have opened a PR but I don't seem to have permission to do so). Lines 15-18 will still make sure that an appropriate llvm version was selected so it feels like trying out all of these higher versions in hopes of finding the right one seems redundant. I figured this might be in place to make sure that the highest version gets selected in multiple are installed, but as far as I could tell reading online, if no version is specified the highest one will be selected by default anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions