Test project cannot find MLIR cmake config

Hi,
I created a project directory in parallel to my llvm-project directory hoping to execrise some tests in an out-of-tree build. However the my build is reporting that it couldnot find MLIR with find_package. Could anyone suggest what am i missing in cmake?

The project directories of llvm and my own one:

$ tree
.
├── BACKUP
├── llvm-project
└── MyTestProj

My cmakelists file:

cmake_minimum_required(VERSION 3.0.0)
project(MyTestProj VERSION 0.1.0 LANGUAGES CXX C)

set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
set(CMAKE_CXX_STANDARD 17 CACHE STRING “C++ standard to conform to”)

# MLIR settings
find_package(MLIR REQUIRED CONFIG)

Error report:

[cmake] – Found LLVM 14.0.0
[cmake] – Found LLVNMConfig.cmake in: /usr/lib/llvm-14/cmake
[cmake] CMake Error at CMakeLists.txt:8 (find_package):
[cmake] Could not find a package configuration file provided by “MLIR” with any of
[cmake] the following names:
[cmake]
[cmake] MLIRConfig.cmake
[cmake] mlir-config.cmake

Solved by changing the directory to what I found in llvm-project instead of previously installed llvm package. Thanks.

1 Like