[llvm] r181788 - Get the unittests compiling when building with cmake and the setting

Duncan Sands baldrick at free.fr
Tue May 14 06:29:16 PDT 2013


Author: baldrick
Date: Tue May 14 08:29:16 2013
New Revision: 181788

URL: http://llvm.org/viewvc/llvm-project?rev=181788&view=rev
Log:
Get the unittests compiling when building with cmake and the setting
-DLLVM_ENABLE_THREADS=false.

Modified:
    llvm/trunk/unittests/Support/ManagedStatic.cpp
    llvm/trunk/utils/unittest/CMakeLists.txt

Modified: llvm/trunk/unittests/Support/ManagedStatic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ManagedStatic.cpp?rev=181788&r1=181787&r2=181788&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ManagedStatic.cpp (original)
+++ llvm/trunk/unittests/Support/ManagedStatic.cpp Tue May 14 08:29:16 2013
@@ -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*) {

Modified: llvm/trunk/utils/unittest/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/CMakeLists.txt?rev=181788&r1=181787&r2=181788&view=diff
==============================================================================
--- llvm/trunk/utils/unittest/CMakeLists.txt (original)
+++ llvm/trunk/utils/unittest/CMakeLists.txt Tue May 14 08:29:16 2013
@@ -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)





More information about the llvm-commits mailing list