This is an archive of the discontinued LLVM Phabricator instance.

mlir: set CMAKE_INCLUDE_CURRENT_DIR to fix out-of-tree builds
ClosedPublic

Authored by dtzWill on Mar 19 2022, 3:56 PM.

Details

Summary

This option tells CMake to add current source and binary
directories to the include path for each directory[1].

Required include directories from build tree (for generated
files) were previously added in mlir_tablegen but this was
changed in 03078ec20b12605fd4dfd9fe9c98a26c9d2286d7 .

These are still needed, however, for out-of-tree builds
that don't build as part of LLVM (via LLVM_ENABLE_PROJECTS).
Building as part of LLVM works regardless, AFAICT,
because LLVM sets this option and so the MLIR build inherits it.

FWIW, various other (in-tree) LLVM projects set this as well.

And of course this fixes the out-of-tree
mlir-by-itself build scenario I'm using.

[1] https://cmake.org/cmake/help/latest/variable/CMAKE_INCLUDE_CURRENT_DIR.html

Diff Detail

Event Timeline

dtzWill created this revision.Mar 19 2022, 3:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2022, 3:56 PM
dtzWill requested review of this revision.Mar 19 2022, 3:56 PM
mehdi_amini accepted this revision.Mar 19 2022, 4:11 PM
This revision is now accepted and ready to land.Mar 19 2022, 4:11 PM