1 include(LLVMProcessSources)
4 macro(add_llvm_library name)
5 llvm_process_sources( ALL_FILES ${ARGN} )
6 add_library( ${name} ${ALL_FILES} )
7 set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
8 set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
9 if( LLVM_COMMON_DEPENDS )
10 add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
11 endif( LLVM_COMMON_DEPENDS )
12 install(TARGETS ${name}
13 LIBRARY DESTINATION lib
14 ARCHIVE DESTINATION lib)
15 endmacro(add_llvm_library name)
18 macro(add_llvm_executable name)
19 llvm_process_sources( ALL_FILES ${ARGN} )
20 add_executable(${name} ${ALL_FILES})
22 foreach(lib ${LLVM_USED_LIBS})
23 target_link_libraries( ${name} ${lib} )
25 endif( LLVM_USED_LIBS )
26 if( LLVM_LINK_COMPONENTS )
27 llvm_config(${name} ${LLVM_LINK_COMPONENTS})
28 endif( LLVM_LINK_COMPONENTS )
30 target_link_libraries(${name} ${llvm_libs})
32 add_dependencies(${name} llvm-config.target)
34 target_link_libraries(${name} imagehlp psapi)
35 elseif( CMAKE_HOST_UNIX )
36 target_link_libraries(${name} dl)
39 endmacro(add_llvm_executable name)
42 macro(add_llvm_tool name)
43 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
44 add_llvm_executable(${name} ${ARGN})
45 install(TARGETS ${name}
46 RUNTIME DESTINATION bin)
47 endmacro(add_llvm_tool name)
50 macro(add_llvm_example name)
51 # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR})
52 add_llvm_executable(${name} ${ARGN})
53 install(TARGETS ${name}
54 RUNTIME DESTINATION examples)
55 endmacro(add_llvm_example name)
58 macro(add_llvm_target target_name)
60 add_custom_target(${target_name}Table_gen
61 DEPENDS ${TABLEGEN_OUTPUT})
62 add_dependencies(${target_name}Table_gen ${LLVM_COMMON_DEPENDS})
63 endif( TABLEGEN_OUTPUT )
64 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
65 add_partially_linked_object(LLVM${target_name} ${ARGN})
67 add_dependencies(LLVM${target_name} ${target_name}Table_gen)
68 endif( TABLEGEN_OUTPUT )
69 endmacro(add_llvm_target)