[llvm-commits] [llvm] r59383 - /llvm/trunk/cmake/modules/LLVMConfig.cmake

Oscar Fuentes ofv at wanadoo.es
Sat Nov 15 20:13:19 PST 2008


Author: ofv
Date: Sat Nov 15 22:13:19 2008
New Revision: 59383

URL: http://llvm.org/viewvc/llvm-project?rev=59383&view=rev
Log:
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.

Modified:
    llvm/trunk/cmake/modules/LLVMConfig.cmake

Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfig.cmake?rev=59383&r1=59382&r2=59383&view=diff

==============================================================================
--- llvm/trunk/cmake/modules/LLVMConfig.cmake (original)
+++ llvm/trunk/cmake/modules/LLVMConfig.cmake Sat Nov 15 22:13:19 2008
@@ -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 @@
     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 @@
       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 @@
   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 @@
     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 @@
 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 @@
       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





More information about the llvm-commits mailing list