Range-for-ify some things in GlobalMerge
[oota-llvm.git] / utils / unittest / CMakeLists.txt
index 73491f0721d5e700aed054fc5d0bf3be3b864788..b34e22ae0cb42258f9096f675c49d8efc96134f7 100644 (file)
@@ -14,6 +14,7 @@
 # Where gtest's .h files can be found.
 include_directories(
   googletest/include
+  googletest
   )
 
 if(WIN32)
@@ -27,16 +28,24 @@ endif()
 set(LLVM_REQUIRES_RTTI 1)
 add_definitions( -DGTEST_HAS_RTTI=0 )
 
+if (NOT LLVM_ENABLE_THREADS)
+  add_definitions( -DGTEST_HAS_PTHREAD=0 )
+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/gtest.cc
-  googletest/gtest-death-test.cc
-  googletest/gtest-filepath.cc
-  googletest/gtest-port.cc
-  googletest/gtest-printers.cc
-  googletest/gtest-test-part.cc
-  googletest/gtest-typed-test.cc
-  )
+  googletest/src/gtest-all.cc
 
-add_llvm_library(gtest_main
-  UnitTestMain/TestMain.cpp
-  )
+  LINK_LIBS
+  ${LIBS}
+)
+
+add_subdirectory(UnitTestMain)