annotate Resources/Orthanc/CMake/GoogleTestConfiguration.cmake @ 227:9574f06d8588 default tip

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