TableGen.cmake: Functionalize and reformat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201972 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2014-02-23 12:54:15 +00:00
parent 043cc54d6c
commit 46e8559826

View File

@ -52,22 +52,23 @@ function(tablegen project ofn)
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${ofn}.tmp ${ofn}) PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${ofn}.tmp ${ofn})
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn} PARENT_SCOPE) set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn} PARENT_SCOPE)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn} set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn} PROPERTIES
PROPERTIES GENERATED 1) GENERATED 1)
endfunction(tablegen) endfunction()
macro(add_public_tablegen_target target) # Creates a target for publicly exporting tablegen dependencies.
# Creates a target for publicly exporting tablegen dependencies. function(add_public_tablegen_target target)
if( TABLEGEN_OUTPUT ) if(NOT TABLEGEN_OUTPUT)
message(FATAL_ERROR "Requires tablegen() definitions as TABLEGEN_OUTPUT.")
endif()
add_custom_target(${target} add_custom_target(${target}
DEPENDS ${TABLEGEN_OUTPUT}) DEPENDS ${TABLEGEN_OUTPUT})
if (LLVM_COMMON_DEPENDS) if(LLVM_COMMON_DEPENDS)
add_dependencies(${target} ${LLVM_COMMON_DEPENDS}) add_dependencies(${target} ${LLVM_COMMON_DEPENDS})
endif () endif()
set_target_properties(${target} PROPERTIES FOLDER "Tablegenning") set_target_properties(${target} PROPERTIES FOLDER "Tablegenning")
list(APPEND LLVM_COMMON_DEPENDS ${target}) set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${target} PARENT_SCOPE)
endif( TABLEGEN_OUTPUT ) endfunction()
endmacro()
if(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native") set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")