1######################################################################## 2# Experimental CMake build script for Google Test. 3# 4# Consider this a prototype. It will change drastically. For now, 5# this is only for people on the cutting edge. 6# 7# To run the tests for Google Test itself on Linux, use 'make test' or 8# ctest. You can select which tests to run using 'ctest -R regex'. 9# For more options, run 'ctest --help'. 10######################################################################## 11# 12# Project-wide settings 13 14# Where gtest's .h files can be found. 15include_directories( 16 googletest/include 17 googletest 18 googlemock/include 19 googlemock 20 ) 21 22# LLVM requires C++11 but gtest doesn't correctly detect the availability 23# of C++11 on MSVC, so we force it on. 24add_definitions(-DGTEST_LANG_CXX11=1) 25add_definitions(-DGTEST_HAS_TR1_TUPLE=0) 26 27if(WIN32) 28 add_definitions(-DGTEST_OS_WINDOWS=1) 29endif() 30 31if(SUPPORTS_VARIADIC_MACROS_FLAG) 32 add_definitions("-Wno-variadic-macros") 33endif() 34if(SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG) 35 add_definitions("-Wno-gnu-zero-variadic-macro-arguments") 36endif() 37if(CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG) 38 add_definitions("-Wno-covered-switch-default") 39endif() 40 41set(LLVM_REQUIRES_RTTI 1) 42add_definitions( -DGTEST_HAS_RTTI=0 ) 43 44if (NOT LLVM_ENABLE_THREADS) 45 add_definitions( -DGTEST_HAS_PTHREAD=0 ) 46endif() 47 48find_library(LLVM_PTHREAD_LIBRARY_PATH pthread) 49if (LLVM_PTHREAD_LIBRARY_PATH) 50 list(APPEND LIBS pthread) 51endif() 52 53add_llvm_library(gtest 54 googletest/src/gtest-all.cc 55 googlemock/src/gmock-all.cc 56 57 LINK_LIBS 58 ${LIBS} 59 60 LINK_COMPONENTS 61 Support # Depends on llvm::raw_ostream 62 63 # This is a library meant only for the build tree. 64 BUILDTREE_ONLY 65) 66 67add_subdirectory(UnitTestMain) 68