summaryrefslogtreecommitdiff
path: root/mlir/CMakeLists.txt
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-01-03 02:25:06 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-01-07 20:16:18 +0000
commit44e3365775101fec3fd355eda339282258d74415 (patch)
treeab8ebea8266a13bcb3115c3ef0ffcd4405de23e5 /mlir/CMakeLists.txt
parentb99833dc745758042f230add35c75faf4070529f (diff)
downloadllvm-44e3365775101fec3fd355eda339282258d74415.tar.gz
[CMake] Factor out config prefix finding logic
See the docs in the new function for details. I think I found every instance of this copy pasted code. Polly could also use it, but currently does something different, so I will save the behavior change for a future revision. We get the shared, non-installed CMake modules following the pattern established in D116472. It might be good to have LLD and Flang also use this, but that would be a functional change and so I leave it as future work. Reviewed By: beanz, lebedev.ri Differential Revision: https://reviews.llvm.org/D116521
Diffstat (limited to 'mlir/CMakeLists.txt')
-rw-r--r--mlir/CMakeLists.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 28018350cb43..b1b79cf32542 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -33,7 +33,16 @@ set(MLIR_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(MLIR_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
set(MLIR_TOOLS_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+ set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+
+# Make sure that our source directory is on the current cmake module path so
+# that we can include cmake files from this directory.
+list(INSERT CMAKE_MODULE_PATH 0
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+ "${LLVM_COMMON_CMAKE_UTILS}/Modules"
+ )
include(AddMLIR)