summaryrefslogtreecommitdiffstats
path: root/llvm/cmake
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2011-07-25 14:11:55 +0000
committerOscar Fuentes <ofv@wanadoo.es>2011-07-25 14:11:55 +0000
commita2e6274d33e0188ed6b6941f8849edf5861afaef (patch)
tree79a8fd1ff1fccc849b8c027be59cf24d7c58b011 /llvm/cmake
parentb44cd82d9063eb3beb2dd9700a09574add78fdf1 (diff)
downloadbcm5719-llvm-a2e6274d33e0188ed6b6941f8849edf5861afaef.tar.gz
bcm5719-llvm-a2e6274d33e0188ed6b6941f8849edf5861afaef.zip
CMake: generalize the system that creates custom targets for
tablegenning to all libraries and executables. llvm-svn: 135908
Diffstat (limited to 'llvm/cmake')
-rwxr-xr-xllvm/cmake/modules/AddLLVM.cmake13
-rw-r--r--llvm/cmake/modules/TableGen.cmake21
2 files changed, 25 insertions, 9 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index c13143bb0d4..daeb46719c6 100755
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/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/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index 9d67137bb42..6605b5b6048 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/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()
+
OpenPOWER on IntegriCloud