Skip to content

Commit 0a079c7

Browse files
committed
Revert "[flang] Fix finding system install of LLVM/Clang/MLIR in standalone builds (#120914)"
This reverts commit 8e12037. It broke the flang-aarch64-out-of-tree buildbot.
1 parent b93ffa8 commit 0a079c7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

flang/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,13 @@ if (FLANG_STANDALONE_BUILD)
8989
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
9090
endif()
9191

92-
# We need a pre-built/installed version of LLVM.
93-
find_package(LLVM REQUIRED HINTS "${LLVM_DIR}")
9492
# If the user specifies a relative path to LLVM_DIR, the calls to include
9593
# LLVM modules fail. Append the absolute path to LLVM_DIR instead.
9694
get_filename_component(LLVM_DIR_ABSOLUTE ${LLVM_DIR}
9795
REALPATH BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
9896
list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR_ABSOLUTE})
99-
100-
# TODO: Remove when libclangDriver is lifted out of Clang
101-
find_package(Clang REQUIRED PATHS "${CLANG_DIR}")
97+
# We need a pre-built/installed version of LLVM.
98+
find_package(LLVM REQUIRED HINTS "${LLVM_DIR_ABSOLUTE}")
10299

103100
# Users might specify a path to CLANG_DIR that's:
104101
# * a full path, or
@@ -107,11 +104,17 @@ if (FLANG_STANDALONE_BUILD)
107104
# cases.
108105
get_filename_component(
109106
CLANG_DIR_ABSOLUTE
110-
${Clang_DIR}
107+
${CLANG_DIR}
111108
REALPATH
112109
BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
113110
list(APPEND CMAKE_MODULE_PATH ${CLANG_DIR_ABSOLUTE})
114111

112+
# TODO: Remove when libclangDriver is lifted out of Clang
113+
find_package(Clang REQUIRED PATHS "${CLANG_DIR_ABSOLUTE}" NO_DEFAULT_PATH)
114+
if (NOT Clang_FOUND)
115+
message(FATAL_ERROR "Failed to find Clang")
116+
endif()
117+
115118
# If LLVM links to zlib we need the imported targets so we can too.
116119
if(LLVM_ENABLE_ZLIB)
117120
find_package(ZLIB REQUIRED)
@@ -129,12 +132,12 @@ if (FLANG_STANDALONE_BUILD)
129132
include(AddClang)
130133

131134
include(TableGen)
132-
find_package(MLIR REQUIRED CONFIG HINTS ${MLIR_DIR})
133135
# If the user specifies a relative path to MLIR_DIR, the calls to include
134136
# MLIR modules fail. Append the absolute path to MLIR_DIR instead.
135137
get_filename_component(MLIR_DIR_ABSOLUTE ${MLIR_DIR}
136138
REALPATH BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
137139
list(APPEND CMAKE_MODULE_PATH ${MLIR_DIR_ABSOLUTE})
140+
find_package(MLIR REQUIRED CONFIG HINTS ${MLIR_DIR_ABSOLUTE})
138141
# Use SYSTEM for the same reasons as for LLVM includes
139142
include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
140143
include(AddMLIR)

0 commit comments

Comments
 (0)