diff options
author | Oscar Fuentes <ofv@wanadoo.es> | 2011-02-20 22:06:32 +0000 |
---|---|---|
committer | Oscar Fuentes <ofv@wanadoo.es> | 2011-02-20 22:06:32 +0000 |
commit | c8da1ecaf58ff41b652dd53331aace948027039b (patch) | |
tree | 0e98a65a3f62f4395026e13aa3033a8b00606115 /CMakeLists.txt | |
parent | 80f38f0ada19a658ca2b3a6949b8621005aa7b08 (diff) |
New function for tablegenning: clang_tablegen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d923b91e1..9325360bc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,36 @@ configure_file( ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake ${CLANG_BINARY_DIR}/include/clang/Config/config.h) +include(LLVMParseArguments) + +function(clang_tablegen) + # Syntax: + # clang_tablegen output-file [tablegen-arg ...] SOURCE source-file + # [[TARGET cmake-target-name] [DEPENDS extra-dependency ...]] + # + # Generates a custom command for invoking tblgen as + # + # tblgen source-file -o=output-file tablegen-arg ... + # + # and, if cmake-target-name is provided, creates a custom target for + # executing the custom command depending on output-file. It is + # possible to list more files to depend after DEPENDS. + + parse_arguments( CTG "SOURCE;TARGET;DEPENDS" "" ${ARGN} ) + + if( NOT CTG_SOURCE ) + message(FATAL_ERROR "SOURCE source-file required by clang_tablegen") + endif() + + set( LLVM_TARGET_DEFINITIONS ${CTG_SOURCE} ) + tablegen( ${CTG_DEFAULT_ARGS} ) + + list( GET CTG_DEFAULT_ARGS 0 output_file ) + if( CTG_TARGET ) + add_custom_target( ${CTG_TARGET} DEPENDS ${output_file} ${CTG_DEPENDS} ) + endif() +endfunction(clang_tablegen) + macro(add_clang_library name) llvm_process_sources(srcs ${ARGN}) if(MSVC_IDE OR XCODE) |