[Mlir-commits] [mlir] 02db3cf - mlir: set CMAKE_INCLUDE_CURRENT_DIR to fix out-of-tree builds

Will Dietz llvmlistbot at llvm.org
Sat Mar 19 16:24:13 PDT 2022


Author: Will Dietz
Date: 2022-03-19T18:22:09-05:00
New Revision: 02db3cfe7d695da8a3119e0305c21a27af6f605c

URL: https://github.com/llvm/llvm-project/commit/02db3cfe7d695da8a3119e0305c21a27af6f605c
DIFF: https://github.com/llvm/llvm-project/commit/02db3cfe7d695da8a3119e0305c21a27af6f605c.diff

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

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

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D122088

Added: 
    

Modified: 
    mlir/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 1c1a281bf4fe5..00e5606d92df2 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -139,6 +139,8 @@ if(MLIR_ENABLE_BINDINGS_PYTHON)
   mlir_configure_python_dev_packages()
 endif()
 
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
 include_directories( "include")
 include_directories( ${MLIR_INCLUDE_DIR})
 


        


More information about the Mlir-commits mailing list