diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-01-20 21:23:15 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-01-20 21:23:15 +0000 |
commit | e4f11175cb95cd8609c0a81c798a550bd9add685 (patch) | |
tree | 1fd7f092daf79f472b0fbb25c9f83960dbcaa557 /utils/unittest | |
parent | 28f591c3d78d0ad93eec7b599d287ef1cda2a163 (diff) |
Use -Wl,defs when linking.
ELF linkers by default allow shared libraries to contain undefined references
and it is up to the dynamic linker to look for them.
On COFF and MachO, that is not the case.
This creates a situation where a .so might build on an ELF system, but the build
of the corresponding .dylib or .dll will fail.
This patch changes the cmake build to use -Wl,-z,defs when linking and updates
the dependencies so that -DBUILD_SHARED_LIBS=ON build still works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/unittest')
-rw-r--r-- | utils/unittest/CMakeLists.txt | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt index b6d2d6d9e0e..7ac894dff14 100644 --- a/utils/unittest/CMakeLists.txt +++ b/utils/unittest/CMakeLists.txt @@ -38,11 +38,20 @@ if(MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(-D_VARIADIC_MAX=10) endif () +set(LIBS + LLVMSupport # Depends on llvm::raw_ostream +) + +find_library(PTHREAD_LIBRARY_PATH pthread) +if (PTHREAD_LIBRARY_PATH) + list(APPEND LIBS pthread) +endif() + add_llvm_library(gtest googletest/src/gtest-all.cc LINK_LIBS - LLVMSupport # Depends on llvm::raw_ostream - ) + ${LIBS} +) add_subdirectory(UnitTestMain) |