[PATCH] D139623: [llvm][cmake] Fix add_subdirectory build in multi-config
Nhat Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 11 09:43:48 PST 2023
nhat-nguyen added a comment.
@sebastian-ne I'm currently experiencing an `mlir` build issue after this change with the following error:
CMake Error at D:/a/_work/1/b/llvm/lib/cmake/mlir/MLIRConfig.cmake:6 (find_package):
Could not find a package configuration file provided by "LLVM" (requested
version 16.0.0) with any of the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
MLIR.cmake:13 (find_package)
CMakeLists.txt:84 (include)
I believe this is due to `llvm_cmake_builddir ` not being set correctly for `mlir` when `CMAKE_CFG_INTDIR` is `$(Configuration)`. Here's my attempt at fixing the issue -- I'm not particularly well-versed in `cmake`, so I would very much appreciate if you could take a quick look:
From a601cd27cfdeea2d5a7e37091fe73728c78c9ee3 Mon Sep 17 00:00:00 2001
From: Nhat Nguyen <honguye at microsoft.com>
Date: Tue, 10 Jan 2023 14:07:00 -0500
Subject: [PATCH] Attempt fix
---
llvm-project/mlir/cmake/modules/CMakeLists.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm-project/mlir/cmake/modules/CMakeLists.txt b/llvm-project/mlir/cmake/modules/CMakeLists.txt
index 3f15c2d5cd0b..9d4d51c7a6e1 100644
--- a/llvm-project/mlir/cmake/modules/CMakeLists.txt
+++ b/llvm-project/mlir/cmake/modules/CMakeLists.txt
@@ -15,7 +15,8 @@ set(mlir_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir
set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
"Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
# CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(llvm_cmake_builddir "${LLVM_LIBRARY_DIR}/cmake/llvm")
+string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}")
+set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm")
get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS)
export(TARGETS ${MLIR_EXPORTS} FILE ${mlir_cmake_builddir}/MLIRTargets.cmake)
--
2.34.0.windows.1
Thank you!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139623/new/
https://reviews.llvm.org/D139623
More information about the llvm-commits
mailing list