include(AddLLVM)
include(TableGen)
+set(LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_INCLUDE_DIR})
+
if( MINGW )
# People report that -O3 is unreliable on MinGW. The traditional
# build also uses -O2 for that reason:
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()
+ if(NOT ${project}_TABLEGEN_EXE)
+ message(FATAL_ERROR "${project}_TABLEGEN_EXE not set")
+ endif()
file(GLOB local_tds "*.td")
file(GLOB_RECURSE global_tds "${LLVM_MAIN_INCLUDE_DIR}/llvm/*.td")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
# Generate tablegen output in a temporary file.
COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
- -I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR}
+ ${LLVM_TABLEGEN_FLAGS}
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
-o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp
# The file in LLVM_TARGET_DEFINITIONS may be not in the current