Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 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. |
| 15 | include_directories( |
| 16 | googletest/include |
Chandler Carruth | 7c92fbb | 2013-11-15 10:20:45 +0000 | [diff] [blame] | 17 | googletest |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 18 | ) |
| 19 | |
| 20 | if(WIN32) |
| 21 | add_definitions(-DGTEST_OS_WINDOWS=1) |
| 22 | endif() |
| 23 | |
Michael J. Spencer | 33a390e | 2010-10-07 18:12:54 +0000 | [diff] [blame] | 24 | if(SUPPORTS_NO_VARIADIC_MACROS_FLAG) |
| 25 | add_definitions("-Wno-variadic-macros") |
| 26 | endif() |
| 27 | |
Oscar Fuentes | 889c1e7 | 2010-10-17 02:26:16 +0000 | [diff] [blame] | 28 | set(LLVM_REQUIRES_RTTI 1) |
| 29 | add_definitions( -DGTEST_HAS_RTTI=0 ) |
Oscar Fuentes | 889c1e7 | 2010-10-17 02:26:16 +0000 | [diff] [blame] | 30 | |
Duncan Sands | b33790d | 2013-05-14 13:29:16 +0000 | [diff] [blame] | 31 | if (NOT LLVM_ENABLE_THREADS) |
| 32 | add_definitions( -DGTEST_HAS_PTHREAD=0 ) |
| 33 | endif() |
| 34 | |
Justin Holewinski | 6fa89b7 | 2012-06-06 03:11:20 +0000 | [diff] [blame] | 35 | # Visual Studio 2012 only supports up to 8 template parameters in |
| 36 | # std::tr1::tuple by default, but gtest requires 10 |
| 37 | if(MSVC AND MSVC_VERSION EQUAL 1700) |
| 38 | add_definitions(-D_VARIADIC_MAX=10) |
| 39 | endif () |
| 40 | |
Oscar Fuentes | 46d8a93 | 2010-09-25 20:25:25 +0000 | [diff] [blame] | 41 | add_llvm_library(gtest |
Chandler Carruth | 7c92fbb | 2013-11-15 10:20:45 +0000 | [diff] [blame] | 42 | googletest/src/gtest-all.cc |
Oscar Fuentes | 46d8a93 | 2010-09-25 20:25:25 +0000 | [diff] [blame] | 43 | ) |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 44 | |
NAKAMURA Takumi | 0dc73df | 2014-02-10 11:27:41 +0000 | [diff] [blame^] | 45 | # Depends on llvm::raw_ostream |
| 46 | target_link_libraries(gtest |
| 47 | LLVMSupport |
| 48 | ) |
| 49 | |
NAKAMURA Takumi | 1f5cf85 | 2014-01-10 11:02:26 +0000 | [diff] [blame] | 50 | add_subdirectory(UnitTestMain) |