Skip to content

Commit

Permalink
Fix weird CMake issue with custom LLVM (#6519)
Browse files Browse the repository at this point in the history
Without this, cmake fails with:
```
CMake Error in dependencies/llvm/CMakeLists.txt:
  Target "Halide_LLVM" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/repositories/halide/dependencies/llvm/"

  which is prefixed in the source directory.
```

`LLVM_INCLUDE_DIRS` there is `/repositories/llvm-project/llvm/include;/builddirs/llvm-project/build-Clang13/include`,
and `INTERFACE_INCLUDE_DIRECTORIES`'s property beforehand is `` (empty),
but after this line it suddenly becomes `/repositories/halide/dependencies/llvm/$<BUILD_INTERFACE:/repositories/llvm-project/llvm/include;/builddirs/llvm-project/build-Clang13/include>`.

This is quite obscure. I don't really understand what is going on,
but with the patch it builds fine.

(cherry picked from commit 9a530b1)
  • Loading branch information
LebedevRI authored and alexreinking committed Jan 6, 2022
1 parent 0818b8c commit f4efa19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dependencies/llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ add_library(Halide_LLVM INTERFACE)
add_library(Halide::LLVM ALIAS Halide_LLVM)

set_target_properties(Halide_LLVM PROPERTIES EXPORT_NAME LLVM)
target_include_directories(Halide_LLVM INTERFACE $<BUILD_INTERFACE:${LLVM_INCLUDE_DIRS}>)
target_include_directories(Halide_LLVM INTERFACE "$<BUILD_INTERFACE:${LLVM_INCLUDE_DIRS}>")
target_compile_definitions(Halide_LLVM INTERFACE ${Halide_LLVM_DEFS})

# Link LLVM libraries to Halide_LLVM, depending on shared, static, or bundled selection.
Expand Down

0 comments on commit f4efa19

Please sign in to comment.