xref: /aosp_15_r20/external/llvm/utils/unittest/CMakeLists.txt (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker########################################################################
2*9880d681SAndroid Build Coastguard Worker# Experimental CMake build script for Google Test.
3*9880d681SAndroid Build Coastguard Worker#
4*9880d681SAndroid Build Coastguard Worker# Consider this a prototype.  It will change drastically.  For now,
5*9880d681SAndroid Build Coastguard Worker# this is only for people on the cutting edge.
6*9880d681SAndroid Build Coastguard Worker#
7*9880d681SAndroid Build Coastguard Worker# To run the tests for Google Test itself on Linux, use 'make test' or
8*9880d681SAndroid Build Coastguard Worker# ctest.  You can select which tests to run using 'ctest -R regex'.
9*9880d681SAndroid Build Coastguard Worker# For more options, run 'ctest --help'.
10*9880d681SAndroid Build Coastguard Worker########################################################################
11*9880d681SAndroid Build Coastguard Worker#
12*9880d681SAndroid Build Coastguard Worker# Project-wide settings
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker# Where gtest's .h files can be found.
15*9880d681SAndroid Build Coastguard Workerinclude_directories(
16*9880d681SAndroid Build Coastguard Worker  googletest/include
17*9880d681SAndroid Build Coastguard Worker  googletest
18*9880d681SAndroid Build Coastguard Worker  )
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerif(WIN32)
21*9880d681SAndroid Build Coastguard Worker  add_definitions(-DGTEST_OS_WINDOWS=1)
22*9880d681SAndroid Build Coastguard Workerendif()
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerif(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
25*9880d681SAndroid Build Coastguard Worker  add_definitions("-Wno-variadic-macros")
26*9880d681SAndroid Build Coastguard Workerendif()
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerset(LLVM_REQUIRES_RTTI 1)
29*9880d681SAndroid Build Coastguard Workeradd_definitions( -DGTEST_HAS_RTTI=0 )
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerif (NOT LLVM_ENABLE_THREADS)
32*9880d681SAndroid Build Coastguard Worker  add_definitions( -DGTEST_HAS_PTHREAD=0 )
33*9880d681SAndroid Build Coastguard Workerendif()
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Workerfind_library(PTHREAD_LIBRARY_PATH pthread)
36*9880d681SAndroid Build Coastguard Workerif (PTHREAD_LIBRARY_PATH)
37*9880d681SAndroid Build Coastguard Worker  list(APPEND LIBS pthread)
38*9880d681SAndroid Build Coastguard Workerendif()
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workeradd_llvm_library(gtest
41*9880d681SAndroid Build Coastguard Worker  googletest/src/gtest-all.cc
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker  LINK_LIBS
44*9880d681SAndroid Build Coastguard Worker  ${LIBS}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker  LINK_COMPONENTS
47*9880d681SAndroid Build Coastguard Worker  Support # Depends on llvm::raw_ostream
48*9880d681SAndroid Build Coastguard Worker)
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Workeradd_subdirectory(UnitTestMain)
51