blob: b34e22ae0cb42258f9096f675c49d8efc96134f7 [file] [log] [blame]
Michael J. Spencer10d274d2010-09-24 09:01:13 +00001########################################################################
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
Chandler Carruth7c92fbb2013-11-15 10:20:45 +000017 googletest
Michael J. Spencer10d274d2010-09-24 09:01:13 +000018 )
19
20if(WIN32)
21 add_definitions(-DGTEST_OS_WINDOWS=1)
22endif()
23
Michael J. Spencer33a390e2010-10-07 18:12:54 +000024if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
25 add_definitions("-Wno-variadic-macros")
26endif()
27
Oscar Fuentes889c1e72010-10-17 02:26:16 +000028set(LLVM_REQUIRES_RTTI 1)
29add_definitions( -DGTEST_HAS_RTTI=0 )
Oscar Fuentes889c1e72010-10-17 02:26:16 +000030
Duncan Sandsb33790d2013-05-14 13:29:16 +000031if (NOT LLVM_ENABLE_THREADS)
32 add_definitions( -DGTEST_HAS_PTHREAD=0 )
33endif()
34
Rafael Espindolacb274c02015-01-20 21:23:15 +000035set(LIBS
36 LLVMSupport # Depends on llvm::raw_ostream
37)
38
39find_library(PTHREAD_LIBRARY_PATH pthread)
40if (PTHREAD_LIBRARY_PATH)
41 list(APPEND LIBS pthread)
42endif()
43
Oscar Fuentes46d8a932010-09-25 20:25:25 +000044add_llvm_library(gtest
Chandler Carruth7c92fbb2013-11-15 10:20:45 +000045 googletest/src/gtest-all.cc
Michael J. Spencer10d274d2010-09-24 09:01:13 +000046
NAKAMURA Takumi96986862014-02-26 06:41:29 +000047 LINK_LIBS
Rafael Espindolacb274c02015-01-20 21:23:15 +000048 ${LIBS}
49)
NAKAMURA Takumi0dc73df2014-02-10 11:27:41 +000050
NAKAMURA Takumi1f5cf852014-01-10 11:02:26 +000051add_subdirectory(UnitTestMain)