comparison Resources/Orthanc/CMake/GoogleTestConfiguration.cmake @ 145:8b310d571e5b

sync orthanc folder
author Alain Mazy <am@osimis.io>
date Mon, 13 Nov 2023 21:12:54 +0100
parents
children 8335b42be9fc
comparison
equal deleted inserted replaced
144:93c6f12bf339 145:8b310d571e5b
1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
6 #
7 # This program is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public License
9 # as published by the Free Software Foundation, either version 3 of
10 # the License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program. If not, see
19 # <http://www.gnu.org/licenses/>.
20
21
22 if (USE_GOOGLE_TEST_DEBIAN_PACKAGE)
23 find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR
24 NAMES src/gtest-all.cc
25 PATHS
26 ${CROSSTOOL_NG_IMAGE}/usr/src/gtest
27 ${CROSSTOOL_NG_IMAGE}/usr/src/googletest/googletest
28 PATH_SUFFIXES src
29 )
30
31 find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR
32 NAMES gtest.h
33 PATHS
34 ${CROSSTOOL_NG_IMAGE}/usr/include/gtest
35 )
36
37 message("Path to the Debian Google Test sources: ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}")
38 message("Path to the Debian Google Test includes: ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}")
39
40 set(GOOGLE_TEST_SOURCES
41 ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc
42 )
43
44 include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR})
45
46 if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR
47 NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h)
48 message(FATAL_ERROR "Please install the libgtest-dev package")
49 endif()
50
51 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST)
52 set(GOOGLE_TEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/googletest-release-1.8.1)
53 set(GOOGLE_TEST_URL "https://orthanc.uclouvain.be/third-party-downloads/gtest-1.8.1.tar.gz")
54 set(GOOGLE_TEST_MD5 "2e6fbeb6a91310a16efe181886c59596")
55
56 DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}")
57
58 include_directories(
59 ${GOOGLE_TEST_SOURCES_DIR}/googletest
60 ${GOOGLE_TEST_SOURCES_DIR}/googletest/include
61 ${GOOGLE_TEST_SOURCES_DIR}
62 )
63
64 set(GOOGLE_TEST_SOURCES
65 ${GOOGLE_TEST_SOURCES_DIR}/googletest/src/gtest-all.cc
66 )
67
68 # https://code.google.com/p/googletest/issues/detail?id=412
69 if (MSVC) # VS2012 does not support tuples correctly yet
70 add_definitions(/D _VARIADIC_MAX=10)
71 endif()
72
73 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
74 add_definitions(-DGTEST_HAS_CLONE=0)
75 endif()
76
77 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*)
78
79 else()
80 include(FindGTest)
81 if (NOT GTEST_FOUND)
82 message(FATAL_ERROR "Unable to find GoogleTest")
83 endif()
84
85 include_directories(${GTEST_INCLUDE_DIRS})
86
87 # The variable GTEST_LIBRARIES contains the shared library of
88 # Google Test, create an alias for more uniformity
89 set(GOOGLE_TEST_LIBRARIES ${GTEST_LIBRARIES})
90 endif()