[flang-commits] [clang] [flang] [CIR] Fix relative include directories (PR #234419)
Andy Kaylor via flang-commits
flang-commits at lists.llvm.org
Wed Oct 21 15:55:39 PDT 2026
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/234419
CIR had several places in the make files where we were setting include paths using CMAKE_BINARY_DIR as a root, but some build bots had problems with this because they were using a non-default build directory layout. CIR should instead have been using LLVM_BINARY_DIR. This change fixes that.
>From 57420c444e826ac7286af203284c25a41433030f Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akaylor at nvidia.com>
Date: Wed, 21 Oct 2026 15:49:58 -0700
Subject: [PATCH] [CIR] Fix relative include directories
CIR had several places in the make files where we were setting include
paths using CMAKE_BINARY_DIR as a root, but some build bots had problems
with this because they were using a non-default build directory layout.
CIR should instead have been using LLVM_BINARY_DIR. This change fixes that.
---
clang/include/clang/CIR/CMakeLists.txt | 2 +-
clang/include/clang/CIR/Dialect/CMakeLists.txt | 2 +-
clang/lib/CIR/CMakeLists.txt | 2 +-
clang/lib/FrontendTool/CMakeLists.txt | 4 ++--
clang/test/CIR/lib/CMakeLists.txt | 2 +-
clang/tools/cir-lsp-server/CMakeLists.txt | 2 +-
clang/tools/cir-opt/CMakeLists.txt | 2 +-
clang/tools/cir-translate/CMakeLists.txt | 2 +-
clang/unittests/CIR/CMakeLists.txt | 2 +-
flang/CMakeLists.txt | 2 +-
10 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/clang/include/clang/CIR/CMakeLists.txt b/clang/include/clang/CIR/CMakeLists.txt
index e20c896171c928..73641606af4253 100644
--- a/clang/include/clang/CIR/CMakeLists.txt
+++ b/clang/include/clang/CIR/CMakeLists.txt
@@ -1,5 +1,5 @@
set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir
-set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
+set(MLIR_TABLEGEN_OUTPUT_DIR ${LLVM_BINARY_DIR}/tools/mlir/include)
include_directories(${MLIR_INCLUDE_DIR})
include_directories(${MLIR_TABLEGEN_OUTPUT_DIR})
diff --git a/clang/include/clang/CIR/Dialect/CMakeLists.txt b/clang/include/clang/CIR/Dialect/CMakeLists.txt
index 9539269cd78ee5..2465b537cd81bc 100644
--- a/clang/include/clang/CIR/Dialect/CMakeLists.txt
+++ b/clang/include/clang/CIR/Dialect/CMakeLists.txt
@@ -10,7 +10,7 @@ function(add_clang_mlir_doc doc_filename output_file output_directory command)
# roots from LLVM dirs instead (as CIR/CMakeLists.txt already does).
tablegen(MLIR ${output_file}.md ${command} ${ARGN}
EXTRA_INCLUDES ${LLVM_MAIN_SRC_DIR}/../mlir/include
- ${CMAKE_BINARY_DIR}/tools/mlir/include)
+ ${LLVM_BINARY_DIR}/tools/mlir/include)
set(GEN_DOC_FILE ${CLANG_BINARY_DIR}/docs/CIR/_raw/${output_directory}${output_file}.md)
add_custom_command(
OUTPUT ${GEN_DOC_FILE}
diff --git a/clang/lib/CIR/CMakeLists.txt b/clang/lib/CIR/CMakeLists.txt
index c63c84afc8fa31..9b1025f671793f 100644
--- a/clang/lib/CIR/CMakeLists.txt
+++ b/clang/lib/CIR/CMakeLists.txt
@@ -1,5 +1,5 @@
include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
-include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+include_directories(${LLVM_BINARY_DIR}/tools/mlir/include)
add_subdirectory(Dialect)
add_subdirectory(CodeGen)
diff --git a/clang/lib/FrontendTool/CMakeLists.txt b/clang/lib/FrontendTool/CMakeLists.txt
index 2e9ce83d25fe1d..f4d1834bdb15b6 100644
--- a/clang/lib/FrontendTool/CMakeLists.txt
+++ b/clang/lib/FrontendTool/CMakeLists.txt
@@ -35,7 +35,7 @@ if(CLANG_ENABLE_CIR)
)
include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
- include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+ include_directories(${LLVM_BINARY_DIR}/tools/mlir/include)
endif()
if(CLANG_ENABLE_STATIC_ANALYZER)
@@ -57,5 +57,5 @@ add_clang_library(clangFrontendTool
if(CLANG_ENABLE_CIR)
target_include_directories(clangFrontendTool PRIVATE ${LLVM_MAIN_SRC_DIR}/../mlir/include)
- target_include_directories(clangFrontendTool PRIVATE ${CMAKE_BINARY_DIR}/tools/mlir/include)
+ target_include_directories(clangFrontendTool PRIVATE ${LLVM_BINARY_DIR}/tools/mlir/include)
endif()
diff --git a/clang/test/CIR/lib/CMakeLists.txt b/clang/test/CIR/lib/CMakeLists.txt
index a084defdbdddb8..910ebd1512e416 100644
--- a/clang/test/CIR/lib/CMakeLists.txt
+++ b/clang/test/CIR/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
-include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+include_directories(${LLVM_BINARY_DIR}/tools/mlir/include)
add_subdirectory(Analysis)
diff --git a/clang/tools/cir-lsp-server/CMakeLists.txt b/clang/tools/cir-lsp-server/CMakeLists.txt
index c92019a8d63fb9..5fb4422c3e7958 100644
--- a/clang/tools/cir-lsp-server/CMakeLists.txt
+++ b/clang/tools/cir-lsp-server/CMakeLists.txt
@@ -1,5 +1,5 @@
include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
-include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+include_directories(${LLVM_BINARY_DIR}/tools/mlir/include)
set(LIBS
${test_libs}
diff --git a/clang/tools/cir-opt/CMakeLists.txt b/clang/tools/cir-opt/CMakeLists.txt
index e64f5c3dad69bd..0203721cf5a1aa 100644
--- a/clang/tools/cir-opt/CMakeLists.txt
+++ b/clang/tools/cir-opt/CMakeLists.txt
@@ -1,5 +1,5 @@
include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
-include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+include_directories(${LLVM_BINARY_DIR}/tools/mlir/include)
if(CLANG_INCLUDE_TESTS)
set(cir_opt_test_libs CIRTestAnalysis)
diff --git a/clang/tools/cir-translate/CMakeLists.txt b/clang/tools/cir-translate/CMakeLists.txt
index f3b7b8533a7bcf..f12186efe23c9a 100644
--- a/clang/tools/cir-translate/CMakeLists.txt
+++ b/clang/tools/cir-translate/CMakeLists.txt
@@ -1,5 +1,5 @@
include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
-include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+include_directories(${LLVM_BINARY_DIR}/tools/mlir/include)
add_clang_tool(cir-translate
cir-translate.cpp
diff --git a/clang/unittests/CIR/CMakeLists.txt b/clang/unittests/CIR/CMakeLists.txt
index d4392b86cc3478..04361a54932b71 100644
--- a/clang/unittests/CIR/CMakeLists.txt
+++ b/clang/unittests/CIR/CMakeLists.txt
@@ -1,5 +1,5 @@
set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include )
-set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
+set(MLIR_TABLEGEN_OUTPUT_DIR ${LLVM_BINARY_DIR}/tools/mlir/include)
include_directories(SYSTEM ${MLIR_INCLUDE_DIR})
include_directories(${MLIR_TABLEGEN_OUTPUT_DIR})
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 83e9655220590e..49fff61d2489f5 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -262,7 +262,7 @@ else()
endif()
set(MLIR_INCLUDE_DIRS ${MLIR_MAIN_SRC_DIR}/include ) # --includedir
- set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
+ set(MLIR_TABLEGEN_OUTPUT_DIR ${LLVM_BINARY_DIR}/tools/mlir/include)
include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
endif()
More information about the flang-commits
mailing list