aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm/cmake/modules/TableGen.cmake12
-rw-r--r--mlir/cmake/modules/AddMLIR.cmake1
2 files changed, 9 insertions, 4 deletions
diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index 67a628d..9a2e73a 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -4,10 +4,6 @@
# Adds the name of the generated file to TABLEGEN_OUTPUT.
include(LLVMDistributionSupport)
-# Clear out any pre-existing compile_commands file before processing. This
-# allows for generating a clean compile_commands on each configure.
-file(REMOVE ${CMAKE_BINARY_DIR}/tablegen_compile_commands.yml)
-
function(tablegen project ofn)
cmake_parse_arguments(ARG "" "" "DEPENDS;EXTRA_INCLUDES" ${ARGN})
@@ -250,3 +246,11 @@ macro(add_tablegen target project)
set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
endif()
endmacro()
+
+# Make sure 'tablegen_compile_commands.yml' is only deleted once the very
+# first time this file is included.
+include_guard(GLOBAL)
+
+# Clear out any pre-existing compile_commands file before processing. This
+# allows for generating a clean compile_commands on each configure.
+file(REMOVE ${CMAKE_BINARY_DIR}/tablegen_compile_commands.yml)
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 353e64b..ff4269e 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -1,3 +1,4 @@
+include(TableGen)
include(GNUInstallDirs)
include(LLVMDistributionSupport)