1 ########################################################################
2 # Experimental CMake build script for Google Test.
4 # Consider this a prototype. It will change drastically. For now,
5 # this is only for people on the cutting edge.
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 ########################################################################
12 # Project-wide settings
14 # Where gtest's .h files can be found.
22 # LLVM requires C++11 but gtest doesn't correctly detect the availability
23 # of C++11 on MSVC, so we force it on.
24 add_definitions(-DGTEST_LANG_CXX11=1)
25 add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
28 add_definitions(-DGTEST_OS_WINDOWS=1)
31 # Google Test requires headers which need _ALL_SOURCE to build on AIX
32 if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
33 remove_definitions("-D_XOPEN_SOURCE=700")
34 add_definitions("-D_ALL_SOURCE")
37 if(SUPPORTS_VARIADIC_MACROS_FLAG)
38 add_definitions("-Wno-variadic-macros")
40 if(SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG)
41 add_definitions("-Wno-gnu-zero-variadic-macro-arguments")
43 if(CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG)
44 add_definitions("-Wno-covered-switch-default")
47 set(LLVM_REQUIRES_RTTI 1)
48 add_definitions( -DGTEST_HAS_RTTI=0 )
50 if (NOT LLVM_ENABLE_THREADS)
51 add_definitions( -DGTEST_HAS_PTHREAD=0 )
54 find_library(LLVM_PTHREAD_LIBRARY_PATH pthread)
55 if (LLVM_PTHREAD_LIBRARY_PATH)
56 list(APPEND LIBS pthread)
59 add_llvm_library(gtest
60 googletest/src/gtest-all.cc
61 googlemock/src/gmock-all.cc
67 Support # Depends on llvm::raw_ostream
69 # This is a library meant only for the build tree.
73 add_subdirectory(UnitTestMain)