llvm.org GIT mirror llvm / 1bbdd46
CMake: Fixed dependencies of .cpp source files on .td and tablegenned files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59325 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
4 changed file(s) with 20 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 include(LLVMProcessSources)
1 include(LLVMConfig)
12
23 macro(add_llvm_library name)
4 llvm_process_sources( ${ARGN} )
35 add_library( ${name} ${ARGN} )
46 set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
57 set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
1315
1416
1517 macro(add_llvm_executable name)
18 llvm_process_sources( ${ARGN} )
1619 add_executable(${name} ${ARGN})
1720 if( LLVM_USED_LIBS )
1821 foreach(lib ${LLVM_USED_LIBS})
0 include(LLVMProcessSources)
1
12 macro(target_name_of_partially_linked_object lib var)
23 if( MSVC )
1415 set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${lib}.o)
1516 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
1617 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
18 llvm_process_sources( ${ARGN} )
1719 add_library( ${lib} STATIC ${ARGN})
1820 if( LLVM_COMMON_DEPENDS )
1921 add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
0 include(AddFileDependencies)
1
2 function(llvm_process_sources)
3 set( sources ${ARGN} )
4 # Create file dependencies on the tablegenned files, if any. Seems
5 # that this is not strictly needed, as dependencies of the .cpp
6 # sources on the tablegenned .inc files are detected and handled,
7 # but just in case...
8 foreach( s ${sources} )
9 set( f ${CMAKE_CURRENT_SOURCE_DIR}/${s} )
10 add_file_dependencies( ${f} ${TABLEGEN_OUTPUT} )
11 endforeach(s)
12 endfunction(llvm_process_sources)
22 # Adds the name of the generated file to TABLEGEN_OUTPUT.
33
44 macro(tablegen ofn)
5 file(GLOB all_tds "*.td")
56 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
67 COMMAND ${LLVM_TABLEGEN} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn}
7 DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS}
8 DEPENDS tblgen ${all_tds}
89 COMMENT "Building ${ofn}..."
910 )
1011 set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})