@@ -81,13 +81,12 @@ if (FLANG_STANDALONE_BUILD)
8181 mark_as_advanced (LLVM_ENABLE_ASSERTIONS)
8282 endif ()
8383
84+ # We need a pre-built/installed version of LLVM.
85+ find_package (LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR} " )
8486 # If the user specifies a relative path to LLVM_DIR, the calls to include
8587 # LLVM modules fail. Append the absolute path to LLVM_DIR instead.
86- get_filename_component (LLVM_DIR_ABSOLUTE ${LLVM_DIR}
87- REALPATH BASE_DIR ${CMAKE_CURRENT_BINARY_DIR} )
88+ get_filename_component (LLVM_DIR_ABSOLUTE ${LLVM_DIR} REALPATH)
8889 list (APPEND CMAKE_MODULE_PATH ${LLVM_DIR_ABSOLUTE} )
89- # We need a pre-built/installed version of LLVM.
90- find_package (LLVM REQUIRED HINTS "${LLVM_DIR_ABSOLUTE} " )
9190
9291 # Users might specify a path to CLANG_DIR that's:
9392 # * a full path, or
@@ -98,7 +97,7 @@ if (FLANG_STANDALONE_BUILD)
9897 CLANG_DIR_ABSOLUTE
9998 ${CLANG_DIR}
10099 REALPATH
101- BASE_DIR ${CMAKE_CURRENT_BINARY_DIR } )
100+ ${CMAKE_CURRENT_SOURCE_DIR } )
102101 list (APPEND CMAKE_MODULE_PATH ${CLANG_DIR_ABSOLUTE} )
103102
104103 # TODO: Remove when libclangDriver is lifted out of Clang
@@ -125,14 +124,13 @@ if (FLANG_STANDALONE_BUILD)
125124 include (AddClang)
126125
127126 include (TableGen)
127+ find_package (MLIR REQUIRED CONFIG)
128+ # Use SYSTEM for the same reasons as for LLVM includes
129+ include_directories (SYSTEM ${MLIR_INCLUDE_DIRS} )
128130 # If the user specifies a relative path to MLIR_DIR, the calls to include
129131 # MLIR modules fail. Append the absolute path to MLIR_DIR instead.
130- get_filename_component (MLIR_DIR_ABSOLUTE ${MLIR_DIR}
131- REALPATH BASE_DIR ${CMAKE_CURRENT_BINARY_DIR} )
132+ get_filename_component (MLIR_DIR_ABSOLUTE ${MLIR_DIR} REALPATH)
132133 list (APPEND CMAKE_MODULE_PATH ${MLIR_DIR_ABSOLUTE} )
133- find_package (MLIR REQUIRED CONFIG HINTS ${MLIR_DIR_ABSOLUTE} )
134- # Use SYSTEM for the same reasons as for LLVM includes
135- include_directories (SYSTEM ${MLIR_INCLUDE_DIRS} )
136134 include (AddMLIR)
137135 find_program (MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR}
138136 NO_DEFAULT_PATH)
0 commit comments