Compiler projects using llvm
import("//llvm/utils/gn/build/libs/pthread/enable.gni")

# Used to push the gtest include directories to things depending on :googletest.
config("googletest_config") {
  include_dirs = [
    "googlemock/include",
    "googletest/include",
  ]

  # LLVM requires C++11 but gtest doesn't correctly detect the availability
  # of C++11 on MSVC, so we force it on.
  defines = [ "GTEST_LANG_CXX11" ]
  if (host_os == "win") {
    defines += [ "GTEST_OS_WINDOWS" ]
  }
  if (!llvm_enable_threads) {
    defines += [ "GTEST_HAS_PTHREAD=0" ]
  }
  defines += [ "GTEST_HAS_RTTI=0" ]
}

static_library("gtest") {
  deps = [ "//llvm/lib/Support" ]
  include_dirs = [
    "googletest",  # For including src/gtest.cc
    "googlemock",  # For including src/gmock.cc
  ]
  public_configs = [ ":googletest_config" ]
  configs -= [ "//llvm/utils/gn/build:warn_covered_switch_default" ]
  configs -= [ "//llvm/utils/gn/build:no_rtti" ]
  sources = [
    "googlemock/src/gmock-all.cc",
    "googletest/src/gtest-all.cc",
  ]
  testonly = true
}