[Mlir-commits] [mlir] [mlir] Prepend include directories before LLVM includes (PR #121223)

Michał Górny llvmlistbot at llvm.org
Fri Dec 27 11:04:32 PST 2024


https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/121223

Prepend mlir's include directories before system LLVM include directories.  This is particularly important for standalone builds, where system include directory may contain the previous version of mlir, and therefore various mlir targets (particularly tablegen) end up using the headers from the previous version over the fresh ones.  The new logic is copied from clang.

>From 180fa9cd7ea3bb8ea3248b57c55d28555102edc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Fri, 27 Dec 2024 20:01:04 +0100
Subject: [PATCH] [mlir] Prepend include directories before LLVM includes

Prepend mlir's include directories before system LLVM include
directories.  This is particularly important for standalone builds,
where system include directory may contain the previous version of mlir,
and therefore various mlir targets (particularly tablegen) end up using
the headers from the previous version over the fresh ones.  The new
logic is copied from clang.
---
 mlir/CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 5ea49c0dbfa7e3..7416e522083b7b 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -196,8 +196,10 @@ endif()
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 
-include_directories( "include")
-include_directories( ${MLIR_INCLUDE_DIR})
+include_directories(BEFORE
+  "include"
+  ${MLIR_INCLUDE_DIR}
+  )
 
 # Adding tools/mlir-tblgen here as calling add_tablegen sets some variables like
 # MLIR_TABLEGEN_EXE in PARENT_SCOPE which gets lost if that folder is included



More information about the Mlir-commits mailing list