diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-09-13 14:04:57 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-09-13 14:04:57 +0000 |
commit | 484db99999ebadcc62bd5ac5a702d1fdad391111 (patch) | |
tree | 65d75e0e6ada7b912234d0b49169f9821ee58fd5 /lib/tsan/CMakeLists.txt | |
parent | deb0dd86b99170abfdfb39520064c49b3e91b0cc (diff) | |
download | compiler-rt-484db99999ebadcc62bd5ac5a702d1fdad391111.tar.gz |
[TSan] support building TSan unittests in CMake
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/CMakeLists.txt')
-rw-r--r-- | lib/tsan/CMakeLists.txt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/tsan/CMakeLists.txt b/lib/tsan/CMakeLists.txt index fc20cd88b..39f3ed346 100644 --- a/lib/tsan/CMakeLists.txt +++ b/lib/tsan/CMakeLists.txt @@ -15,4 +15,33 @@ else() endif() add_subdirectory(rtl) + +if(LLVM_INCLUDE_TESTS) + add_custom_target(TsanUnitTests) + set_target_properties(TsanUnitTests PROPERTIES + FOLDER "TSan unittests") + + function(add_tsan_unittest testname) + # Build unit tests only on 64-bit Linux. + if(UNIX AND NOT APPLE + AND CAN_TARGET_X86_64 + AND CMAKE_SIZEOF_VOID_P EQUAL 8 + AND NOT LLVM_BUILD_32_BITS) + add_unittest(TsanUnitTests ${testname} ${ARGN}) + # Link with TSan runtime. + target_link_libraries(${testname} clang_rt.tsan-x86_64) + # Build tests with PIE and debug info. + set_property(TARGET ${testname} APPEND_STRING + PROPERTY COMPILE_FLAGS " -fPIE -g") + set_property(TARGET ${testname} APPEND_STRING + PROPERTY LINK_FLAGS " -pie") + endif() + endfunction() + + include_directories(rtl) + # There are two groups of unit tests: rtl_tests and unit_tests. + add_subdirectory(rtl_tests) + add_subdirectory(unit_tests) +endif() + # FIXME: Support TSan runtime tests, unit tests and output tests. |