Get the unittests compiling when building with cmake and the setting
authorDuncan Sands <baldrick@free.fr>
Tue, 14 May 2013 13:29:16 +0000 (13:29 +0000)
committerDuncan Sands <baldrick@free.fr>
Tue, 14 May 2013 13:29:16 +0000 (13:29 +0000)
-DLLVM_ENABLE_THREADS=false.

llvm-svn: 181788

llvm/unittests/Support/ManagedStatic.cpp
llvm/utils/unittest/CMakeLists.txt

index 8ddad38..1497f4e 100644 (file)
@@ -19,7 +19,8 @@ using namespace llvm;
 
 namespace {
 
-#if defined(HAVE_PTHREAD_H) && !__has_feature(memory_sanitizer)
+#if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H) && \
+  !__has_feature(memory_sanitizer)
 namespace test1 {
   llvm::ManagedStatic<int> ms;
   void *helper(void*) {
index 70ed35d..8bdfee1 100644 (file)
@@ -27,6 +27,10 @@ endif()
 set(LLVM_REQUIRES_RTTI 1)
 add_definitions( -DGTEST_HAS_RTTI=0 )
 
+if (NOT LLVM_ENABLE_THREADS)
+  add_definitions( -DGTEST_HAS_PTHREAD=0 )
+endif()
+
 # Visual Studio 2012 only supports up to 8 template parameters in
 # std::tr1::tuple by default, but gtest requires 10
 if(MSVC AND MSVC_VERSION EQUAL 1700)