diff options
author | Oscar Fuentes <ofv@wanadoo.es> | 2011-07-25 14:11:55 +0000 |
---|---|---|
committer | Oscar Fuentes <ofv@wanadoo.es> | 2011-07-25 14:11:55 +0000 |
commit | ddfb69cd47b6062bde9d6a0ac1576ad8ddcb5a9e (patch) | |
tree | 4f260b1c377eb73ab83724928b61977a4d6724db /cmake | |
parent | 6d0ac80d5e0412fc2dae8566a272159042af0006 (diff) | |
download | external_llvm-ddfb69cd47b6062bde9d6a0ac1576ad8ddcb5a9e.zip external_llvm-ddfb69cd47b6062bde9d6a0ac1576ad8ddcb5a9e.tar.gz external_llvm-ddfb69cd47b6062bde9d6a0ac1576ad8ddcb5a9e.tar.bz2 |
CMake: generalize the system that creates custom targets for
tablegenning to all libraries and executables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-x | cmake/modules/AddLLVM.cmake | 13 | ||||
-rw-r--r-- | cmake/modules/TableGen.cmake | 21 |
2 files changed, 25 insertions, 9 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index c13143b..daeb467 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -2,6 +2,7 @@ include(LLVMProcessSources) include(LLVM-Config) macro(add_llvm_library name) + create_tablegenning_custom_target( ${name} ) llvm_process_sources( ALL_FILES ${ARGN} ) add_library( ${name} ${ALL_FILES} ) set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} ) @@ -32,6 +33,7 @@ macro(add_llvm_library name) add_dependencies(${name} ${CURRENT_LLVM_TARGET}) endif() set_target_properties(${name} PROPERTIES FOLDER "Libraries") + add_tablegenning_dependency( ${name} ) endmacro(add_llvm_library name) @@ -75,6 +77,7 @@ endmacro(add_llvm_loadable_module name) macro(add_llvm_executable name) + create_tablegenning_custom_target( ${name} ) llvm_process_sources( ALL_FILES ${ARGN} ) if( EXCLUDE_FROM_ALL ) add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES}) @@ -88,6 +91,7 @@ macro(add_llvm_executable name) add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) endif( LLVM_COMMON_DEPENDS ) link_system_libs( ${name} ) + add_tablegenning_dependency( ${name} ) endmacro(add_llvm_executable name) @@ -124,16 +128,7 @@ endmacro(add_llvm_utility name) macro(add_llvm_target target_name) - if( TABLEGEN_OUTPUT ) - add_custom_target(${target_name}Table_gen - DEPENDS ${TABLEGEN_OUTPUT}) - add_dependencies(${target_name}Table_gen ${LLVM_COMMON_DEPENDS}) - endif( TABLEGEN_OUTPUT ) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT}) - if ( TABLEGEN_OUTPUT ) - add_dependencies(LLVM${target_name} ${target_name}Table_gen) - set_target_properties(${target_name}Table_gen PROPERTIES FOLDER "Tablegenning") - endif (TABLEGEN_OUTPUT) set( CURRENT_LLVM_TARGET LLVM${target_name} ) endmacro(add_llvm_target) diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake index 9d67137..6605b5b 100644 --- a/cmake/modules/TableGen.cmake +++ b/cmake/modules/TableGen.cmake @@ -44,3 +44,24 @@ macro(tablegen ofn) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn} PROPERTIES GENERATED 1) endmacro(tablegen) + + +function(create_tablegenning_custom_target target) + # Creates the global target that runs the file-level dependencies + # for tablegenning. + if( TABLEGEN_OUTPUT ) + add_custom_target(${target}Table_gen + DEPENDS ${TABLEGEN_OUTPUT}) + add_dependencies(${target}Table_gen ${LLVM_COMMON_DEPENDS}) + endif( TABLEGEN_OUTPUT ) +endfunction() + +function(add_tablegenning_dependency target) + # Makes the tablegenning step created with + # create_tablegenning_custom_target dependent on `target'. + if ( TABLEGEN_OUTPUT ) + add_dependencies(${target} ${target}Table_gen) + set_target_properties(${target}Table_gen PROPERTIES FOLDER "Tablegenning") + endif (TABLEGEN_OUTPUT) +endfunction() + |