diff options
author | Oscar Fuentes <ofv@wanadoo.es> | 2011-03-29 20:51:08 +0000 |
---|---|---|
committer | Oscar Fuentes <ofv@wanadoo.es> | 2011-03-29 20:51:08 +0000 |
commit | 23f0bfeda93da3b14af879dc88c2434afb98a822 (patch) | |
tree | ee3cfba176f2912f57add2d57fbb0548c7b6ebb3 /cmake/modules/AddLLVM.cmake | |
parent | ec3f22782058058a712ae8e8313e25a273396824 (diff) | |
download | llvm-23f0bfeda93da3b14af879dc88c2434afb98a822.tar.gz llvm-23f0bfeda93da3b14af879dc88c2434afb98a822.tar.bz2 llvm-23f0bfeda93da3b14af879dc88c2434afb98a822.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/modules/AddLLVM.cmake')
-rwxr-xr-x | cmake/modules/AddLLVM.cmake | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index f0dc106d3a..df739b4119 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/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) |