From fac6be61c6ccbae15647f4f2485415f630341e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 1 Jan 2025 15:31:49 +0000 Subject: [PATCH] [mlir] Prepend include directories before LLVM includes (#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. --- mlir/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index 5ea49c0dbfa7e36..7416e522083b7bc 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