]> git.proxmox.com Git - ceph.git/blame - ceph/src/fmt/test/gtest/CMakeLists.txt
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / fmt / test / gtest / CMakeLists.txt
CommitLineData
20effc67
TL
1#------------------------------------------------------------------------------
2# Build the google test library
3
4# We compile Google Test ourselves instead of using pre-compiled libraries.
5# See the Google Test FAQ "Why is it not recommended to install a
6# pre-compiled copy of Google Test (for example, into /usr/local)?"
7# at http://code.google.com/p/googletest/wiki/FAQ for more details.
8add_library(gtest STATIC
9 gmock-gtest-all.cc gmock/gmock.h gtest/gtest.h gtest/gtest-spi.h)
10target_compile_definitions(gtest PUBLIC GTEST_HAS_STD_WSTRING=1)
11target_include_directories(gtest SYSTEM PUBLIC .)
12
13find_package(Threads)
14if (Threads_FOUND)
15 target_link_libraries(gtest ${CMAKE_THREAD_LIBS_INIT})
16else ()
17 target_compile_definitions(gtest PUBLIC GTEST_HAS_PTHREAD=0)
18endif ()
19
1e59de90
TL
20# Workaround GTest bug https://github.com/google/googletest/issues/705.
21fmt_check_cxx_compiler_flag(
22 -fno-delete-null-pointer-checks HAVE_FNO_DELETE_NULL_POINTER_CHECKS)
23if (HAVE_FNO_DELETE_NULL_POINTER_CHECKS)
24 target_compile_options(gtest PUBLIC -fno-delete-null-pointer-checks)
25endif ()
26
20effc67
TL
27if (MSVC)
28 # Disable MSVC warnings of _CRT_INSECURE_DEPRECATE functions.
29 target_compile_definitions(gtest PRIVATE _CRT_SECURE_NO_WARNINGS)
30 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
31 # Disable MSVC warnings of POSIX functions.
32 target_compile_options(gtest PUBLIC -Wno-deprecated-declarations)
33 endif ()
34endif ()
35
36# Silence MSVC tr1 deprecation warning in gmock.
37target_compile_definitions(gtest
38 PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1)