summaryrefslogtreecommitdiff
path: root/cmake/modules/LLVMConfig.cmake
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2008-11-16 04:13:19 +0000
committerOscar Fuentes <ofv@wanadoo.es>2008-11-16 04:13:19 +0000
commit808e3a92661c19cfc466523bfcc3cd506edad7ee (patch)
treee165637c6c5becde8af26b82b7d9d75aecedd231 /cmake/modules/LLVMConfig.cmake
parent1ca0c9922ba79c7d3e145cdee74f0c4cad72beb3 (diff)
downloadllvm-808e3a92661c19cfc466523bfcc3cd506edad7ee.tar.gz
llvm-808e3a92661c19cfc466523bfcc3cd506edad7ee.tar.bz2
llvm-808e3a92661c19cfc466523bfcc3cd506edad7ee.tar.xz
CMake: MSVC: Pass list of components the right way to msvc_llvm_config
and siblings. Support targets whose name does not end on `CodeGen'. Remove a performance bottleneck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59383 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/modules/LLVMConfig.cmake')
-rwxr-xr-xcmake/modules/LLVMConfig.cmake39
1 files changed, 27 insertions, 12 deletions
diff --git a/cmake/modules/LLVMConfig.cmake b/cmake/modules/LLVMConfig.cmake
index 3d5e3bc55a..6ed89bae44 100755
--- a/cmake/modules/LLVMConfig.cmake
+++ b/cmake/modules/LLVMConfig.cmake
@@ -1,13 +1,15 @@
-macro(llvm_config executable link_components)
+macro(llvm_config executable)
+ # extra args is the list of link components.
if( MSVC )
- msvc_llvm_config(${executable} ${link_components})
+ msvc_llvm_config(${executable} ${ARGN})
else( MSVC )
- nix_llvm_config(${executable} ${link_components})
+ nix_llvm_config(${executable} ${ARGN})
endif( MSVC )
-endmacro(llvm_config executable link_components)
+endmacro(llvm_config)
-function(msvc_llvm_config executable link_components)
+function(msvc_llvm_config executable)
+ set( link_components ${ARGN} )
foreach(c ${link_components})
if( c STREQUAL "jit" )
set(lfgs "${lfgs} /INCLUDE:_X86TargetMachineModule")
@@ -22,7 +24,7 @@ function(msvc_llvm_config executable link_components)
endif()
endforeach(c)
- msvc_map_components_to_libraries(${link_components} LIBRARIES)
+ msvc_map_components_to_libraries(LIBRARIES ${link_components})
target_link_libraries(${executable} ${LIBRARIES})
if( lfgs )
@@ -30,15 +32,26 @@ function(msvc_llvm_config executable link_components)
PROPERTIES
LINK_FLAGS ${lfgs})
endif()
-endfunction(msvc_llvm_config executable link_components)
+endfunction(msvc_llvm_config)
-function(msvc_map_components_to_libraries link_components out_libs)
+function(msvc_map_components_to_libraries out_libs)
+ set( link_components ${ARGN} )
foreach(c ${link_components})
# add codegen/asmprinter
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
if( NOT idx LESS 0 )
- list(APPEND expanded_components "LLVM${c}CodeGen")
+ list(FIND llvm_libs "LLVM${c}CodeGen" idx)
+ if( NOT idx LESS 0 )
+ list(APPEND expanded_components "LLVM${c}CodeGen")
+ else()
+ list(FIND llvm_libs "LLVM${c}" idx)
+ if( NOT idx LESS 0 )
+ list(APPEND expanded_components "LLVM${c}")
+ else()
+ message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
+ endif()
+ endif()
list(FIND llvm_libs "LLVM${c}AsmPrinter" asmidx)
if( NOT asmidx LESS 0 )
list(APPEND expanded_components "LLVM${c}AsmPrinter")
@@ -62,6 +75,7 @@ function(msvc_map_components_to_libraries link_components out_libs)
endforeach(c)
# We must match capitalization.
string(TOUPPER "${llvm_libs}" capitalized_libs)
+ list(REMOVE_DUPLICATES expanded_components)
set(curr_idx 0)
list(LENGTH expanded_components lst_size)
while( ${curr_idx} LESS ${lst_size} )
@@ -75,6 +89,7 @@ function(msvc_map_components_to_libraries link_components out_libs)
list(APPEND result ${canonical_lib})
list(APPEND result ${MSVC_LIB_DEPS_${canonical_lib}})
list(APPEND expanded_components ${MSVC_LIB_DEPS_${canonical_lib}})
+ list(REMOVE_DUPLICATES expanded_components)
list(LENGTH expanded_components lst_size)
math(EXPR curr_idx "${curr_idx} + 1")
endwhile( ${curr_idx} LESS ${lst_size} )
@@ -83,9 +98,9 @@ function(msvc_map_components_to_libraries link_components out_libs)
endfunction(msvc_map_components_to_libraries)
-macro(nix_llvm_config executable link_components)
+macro(nix_llvm_config executable)
set(lc "")
- foreach(c ${LLVM_LINK_COMPONENTS})
+ foreach(c ${ARGN})
set(lc "${lc} ${c}")
endforeach(c)
if( NOT HAVE_LLVM_CONFIG )
@@ -116,7 +131,7 @@ macro(nix_llvm_config executable link_components)
endif(c MATCHES ".*\\.o")
endforeach(c)
endif( NOT HAVE_LLVM_CONFIG )
-endmacro(nix_llvm_config executable link_components)
+endmacro(nix_llvm_config)
# This data is used on MSVC for stablishing executable/library