Teach tablegen() macro to check needed variables

This macro depends on several variables to be set in the calling
context.  Check them and report an error if they are not set.
Without this, custom commands may be silently specified that
will fail at build time.

Patch by Brad King.

llvm-svn: 201229
This commit is contained in:
NAKAMURA Takumi 2014-02-12 11:50:11 +00:00
parent 9218e94714
commit 04817e49bc
1 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,17 @@
# Adds the name of the generated file to TABLEGEN_OUTPUT.
function(tablegen project ofn)
# Validate calling context.
foreach(v
${project}_TABLEGEN_EXE
LLVM_MAIN_SRC_DIR
LLVM_MAIN_INCLUDE_DIR
)
if(NOT ${v})
message(FATAL_ERROR "${v} not set")
endif()
endforeach()
file(GLOB local_tds "*.td")
file(GLOB_RECURSE global_tds "${LLVM_MAIN_INCLUDE_DIR}/llvm/*.td")