mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-29 13:54:57 +00:00
Teach LLVM-Config to use logical target names (1/2)
LLVM library names are now available as logical CMake targets both to our own build and to application CMake code. Replace use of 'list(FIND)' with a simple 'if(TARGET)' to determine whether a library is available. Contributed by Brad King. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201852 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
10ecde5c34
commit
83782f2571
@ -104,31 +104,25 @@ function(llvm_map_components_to_libnames out_libs)
|
|||||||
# add codegen, asmprinter, asmparser, disassembler
|
# add codegen, asmprinter, asmparser, disassembler
|
||||||
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
|
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
|
||||||
if( NOT idx LESS 0 )
|
if( NOT idx LESS 0 )
|
||||||
list(FIND llvm_libs "LLVM${c}CodeGen" idx)
|
if( TARGET LLVM${c}CodeGen )
|
||||||
if( NOT idx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}CodeGen")
|
list(APPEND expanded_components "LLVM${c}CodeGen")
|
||||||
else()
|
else()
|
||||||
list(FIND llvm_libs "LLVM${c}" idx)
|
if( TARGET LLVM${c} )
|
||||||
if( NOT idx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}")
|
list(APPEND expanded_components "LLVM${c}")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
|
message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
list(FIND llvm_libs "LLVM${c}AsmPrinter" asmidx)
|
if( TARGET LLVM${c}AsmPrinter )
|
||||||
if( NOT asmidx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}AsmPrinter")
|
list(APPEND expanded_components "LLVM${c}AsmPrinter")
|
||||||
endif()
|
endif()
|
||||||
list(FIND llvm_libs "LLVM${c}AsmParser" asmidx)
|
if( TARGET LLVM${c}AsmParser )
|
||||||
if( NOT asmidx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}AsmParser")
|
list(APPEND expanded_components "LLVM${c}AsmParser")
|
||||||
endif()
|
endif()
|
||||||
list(FIND llvm_libs "LLVM${c}Info" asmidx)
|
if( TARGET LLVM${c}Info )
|
||||||
if( NOT asmidx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}Info")
|
list(APPEND expanded_components "LLVM${c}Info")
|
||||||
endif()
|
endif()
|
||||||
list(FIND llvm_libs "LLVM${c}Disassembler" asmidx)
|
if( TARGET LLVM${c}Disassembler )
|
||||||
if( NOT asmidx LESS 0 )
|
|
||||||
list(APPEND expanded_components "LLVM${c}Disassembler")
|
list(APPEND expanded_components "LLVM${c}Disassembler")
|
||||||
endif()
|
endif()
|
||||||
elseif( c STREQUAL "native" )
|
elseif( c STREQUAL "native" )
|
||||||
@ -189,12 +183,10 @@ endfunction()
|
|||||||
function(explicit_map_components_to_libraries out_libs)
|
function(explicit_map_components_to_libraries out_libs)
|
||||||
llvm_map_components_to_libnames(link_libs ${ARGN})
|
llvm_map_components_to_libnames(link_libs ${ARGN})
|
||||||
llvm_expand_dependencies(expanded_components ${link_libs})
|
llvm_expand_dependencies(expanded_components ${link_libs})
|
||||||
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
|
|
||||||
# Return just the libraries included in this build:
|
# Return just the libraries included in this build:
|
||||||
set(result)
|
set(result)
|
||||||
foreach(c ${expanded_components})
|
foreach(c ${expanded_components})
|
||||||
list(FIND llvm_libs ${c} lib_idx)
|
if( TARGET ${c} )
|
||||||
if( NOT lib_idx LESS 0 )
|
|
||||||
set(result ${result} ${c})
|
set(result ${result} ${c})
|
||||||
endif()
|
endif()
|
||||||
endforeach(c)
|
endforeach(c)
|
||||||
|
Loading…
Reference in New Issue
Block a user