comparison OrthancFramework/Resources/CMake/GoogleTestConfiguration.cmake @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Resources/CMake/GoogleTestConfiguration.cmake@a3e38994d95a
children 304842a0d152
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 if (USE_GOOGLE_TEST_DEBIAN_PACKAGE)
2 find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR
3 NAMES src/gtest-all.cc
4 PATHS
5 ${CROSSTOOL_NG_IMAGE}/usr/src/gtest
6 ${CROSSTOOL_NG_IMAGE}/usr/src/googletest/googletest
7 PATH_SUFFIXES src
8 )
9
10 find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR
11 NAMES gtest.h
12 PATHS
13 ${CROSSTOOL_NG_IMAGE}/usr/include/gtest
14 )
15
16 message("Path to the Debian Google Test sources: ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}")
17 message("Path to the Debian Google Test includes: ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}")
18
19 set(GOOGLE_TEST_SOURCES
20 ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc
21 )
22
23 include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR})
24
25 if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR
26 NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h)
27 message(FATAL_ERROR "Please install the libgtest-dev package")
28 endif()
29
30 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST)
31 set(GOOGLE_TEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/googletest-release-1.8.1)
32 set(GOOGLE_TEST_URL "http://orthanc.osimis.io/ThirdPartyDownloads/gtest-1.8.1.tar.gz")
33 set(GOOGLE_TEST_MD5 "2e6fbeb6a91310a16efe181886c59596")
34
35 DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}")
36
37 include_directories(
38 ${GOOGLE_TEST_SOURCES_DIR}/googletest
39 ${GOOGLE_TEST_SOURCES_DIR}/googletest/include
40 ${GOOGLE_TEST_SOURCES_DIR}
41 )
42
43 set(GOOGLE_TEST_SOURCES
44 ${GOOGLE_TEST_SOURCES_DIR}/googletest/src/gtest-all.cc
45 )
46
47 # https://code.google.com/p/googletest/issues/detail?id=412
48 if (MSVC) # VS2012 does not support tuples correctly yet
49 add_definitions(/D _VARIADIC_MAX=10)
50 endif()
51
52 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
53 add_definitions(-DGTEST_HAS_CLONE=0)
54 endif()
55
56 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*)
57
58 else()
59 include(FindGTest)
60 if (NOT GTEST_FOUND)
61 message(FATAL_ERROR "Unable to find GoogleTest")
62 endif()
63
64 include_directories(${GTEST_INCLUDE_DIRS})
65
66 # The variable GTEST_LIBRARIES contains the shared library of
67 # Google Test, create an alias for more uniformity
68 set(GOOGLE_TEST_LIBRARIES ${GTEST_LIBRARIES})
69 endif()