From: Chris Bieneman Date: Tue, 6 Dec 2016 04:45:11 +0000 (+0000) Subject: [CMake] Cleanup TableGen include flags X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfe568d76602287abdf7253d64b5c4d8b61132e1;p=llvm [CMake] Cleanup TableGen include flags It is kinda crazy to have llvm/include and llvm/lib/Target in the include path for every tablegen invocation for every tablegen-like tool. This patch removes those flags from the tablgen function that is called everywhere by instead creating a variable LLVM_TABLEGEN_FLAGS which is setup in the LLVM source directories. This removes TableGen.cmake's dependency on LLVM_MAIN_SRC_DIR, and LLVM_MAIN_INCLUDE_DIR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288770 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f209338e2c1..08008f9f227 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -803,6 +803,8 @@ endif() 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: diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake index a366299ab49..f966cf2d615 100644 --- a/cmake/modules/TableGen.cmake +++ b/cmake/modules/TableGen.cmake @@ -6,15 +6,9 @@ include(LLVMExternalProjectUtils) 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") @@ -28,7 +22,7 @@ function(tablegen project ofn) 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 diff --git a/lib/Target/CMakeLists.txt b/lib/Target/CMakeLists.txt index 02b030004d4..044db10fb3f 100644 --- a/lib/Target/CMakeLists.txt +++ b/lib/Target/CMakeLists.txt @@ -1,5 +1,7 @@ list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen) +list(APPEND LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_SRC_DIR}/lib/Target) + add_llvm_library(LLVMTarget Target.cpp TargetIntrinsicInfo.cpp