summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2011-03-29 20:51:08 +0000
committerOscar Fuentes <ofv@wanadoo.es>2011-03-29 20:51:08 +0000
commit978e5284fab71a144aadae37d5cacc06318df5d2 (patch)
treeb900f873798730f8cdfbffd207dbe92125252d3d /llvm
parentfda6a4c33a3cbdfca76bfbdae22d6a5256f2802d (diff)
downloadbcm5719-llvm-978e5284fab71a144aadae37d5cacc06318df5d2.tar.gz
bcm5719-llvm-978e5284fab71a144aadae37d5cacc06318df5d2.zip
Fixed the build of Clang's unit tests on MinGW. Also removed some
unnecesary conditionals and introduced a new convenience function. The problem was that the list of libraries for Clang's unit tests was <clang libraries> <system libraries> <llvm libraries>. As the llvm libraries references symbols defined on the system libraries, those were reported as undefined. llvm-svn: 128484
Diffstat (limited to 'llvm')
-rwxr-xr-xllvm/cmake/modules/AddLLVM.cmake24
-rwxr-xr-xllvm/cmake/modules/LLVMConfig.cmake6
2 files changed, 14 insertions, 16 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index f0dc106d3ab..df739b41199 100755
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -11,10 +11,12 @@ macro(add_llvm_library name)
if( BUILD_SHARED_LIBS )
llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
- get_system_libs(sl)
- target_link_libraries( ${name} ${sl} )
endif()
+ # Ensure that the system libraries always comes last on the
+ # list. Without this, linking the unit tests on MinGW fails.
+ link_system_libs( ${name} )
+
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
@@ -47,8 +49,7 @@ ${name} ignored.")
set_target_properties( ${name} PROPERTIES PREFIX "" )
llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
- get_system_libs(sl)
- target_link_libraries( ${name} ${sl} )
+ link_system_libs( ${name} )
if (APPLE)
# Darwin-specific linker flags for loadable modules.
@@ -73,21 +74,12 @@ macro(add_llvm_executable name)
add_executable(${name} ${ALL_FILES})
endif()
set(EXCLUDE_FROM_ALL OFF)
- if( LLVM_USED_LIBS )
- foreach(lib ${LLVM_USED_LIBS})
- target_link_libraries( ${name} ${lib} )
- endforeach(lib)
- endif( LLVM_USED_LIBS )
- if( LLVM_LINK_COMPONENTS )
- llvm_config(${name} ${LLVM_LINK_COMPONENTS})
- endif( LLVM_LINK_COMPONENTS )
+ target_link_libraries( ${name} ${LLVM_USED_LIBS} )
+ llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
- get_system_libs(llvm_system_libs)
- if( llvm_system_libs )
- target_link_libraries(${name} ${llvm_system_libs})
- endif()
+ link_system_libs( ${name} )
endmacro(add_llvm_executable name)
diff --git a/llvm/cmake/modules/LLVMConfig.cmake b/llvm/cmake/modules/LLVMConfig.cmake
index fd1cfa8690e..bd6a7a2c553 100755
--- a/llvm/cmake/modules/LLVMConfig.cmake
+++ b/llvm/cmake/modules/LLVMConfig.cmake
@@ -16,6 +16,12 @@ function(get_system_libs return_var)
endfunction(get_system_libs)
+function(link_system_libs target)
+ get_system_libs(llvm_system_libs)
+ target_link_libraries(${target} ${llvm_system_libs})
+endfunction(link_system_libs)
+
+
function(is_llvm_target_library library return_var)
# Sets variable `return_var' to ON if `library' corresponds to a
# LLVM supported target. To OFF if it doesn't.
OpenPOWER on IntegriCloud