annotate Resources/Orthanc/CMake/GoogleTestConfiguration.cmake @ 153:c78ec45f3695

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 16 Mar 2024 11:55:27 +0100
parents 8335b42be9fc
children 6fada29b6759
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
153
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 148
diff changeset
4 # Copyright (C) 2017-2024 Osimis S.A., Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 148
diff changeset
5 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
145
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
6 #
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
8 # modify it under the terms of the GNU Lesser General Public License
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
9 # as published by the Free Software Foundation, either version 3 of
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
10 # the License, or (at your option) any later version.
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
11 #
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
12 # 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
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
15 # Lesser General Public License for more details.
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
16 #
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
17 # You should have received a copy of the GNU Lesser General Public
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
18 # License along with this program. If not, see
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
19 # <http://www.gnu.org/licenses/>.
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
20
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 if (USE_GOOGLE_TEST_DEBIAN_PACKAGE)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
23 find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
24 NAMES src/gtest-all.cc
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
25 PATHS
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
26 ${CROSSTOOL_NG_IMAGE}/usr/src/gtest
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
27 ${CROSSTOOL_NG_IMAGE}/usr/src/googletest/googletest
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
28 PATH_SUFFIXES src
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
29 )
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 find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
32 NAMES gtest.h
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
33 PATHS
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
34 ${CROSSTOOL_NG_IMAGE}/usr/include/gtest
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
35 )
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 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
38 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
39
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
40 set(GOOGLE_TEST_SOURCES
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
41 ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
42 )
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 include_directories(${GOOGLE_TEST_DEBIAN_SOURCES_DIR})
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
45
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
46 if (NOT EXISTS ${GOOGLE_TEST_SOURCES} OR
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
47 NOT EXISTS ${GOOGLE_TEST_DEBIAN_INCLUDE_DIR}/gtest.h)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
48 message(FATAL_ERROR "Please install the libgtest-dev package")
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
49 endif()
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
50
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
51 elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
52 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
53 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
54 set(GOOGLE_TEST_MD5 "2e6fbeb6a91310a16efe181886c59596")
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
55
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
56 DownloadPackage(${GOOGLE_TEST_MD5} ${GOOGLE_TEST_URL} "${GOOGLE_TEST_SOURCES_DIR}")
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
57
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
58 include_directories(
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
59 ${GOOGLE_TEST_SOURCES_DIR}/googletest
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
60 ${GOOGLE_TEST_SOURCES_DIR}/googletest/include
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
61 ${GOOGLE_TEST_SOURCES_DIR}
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
62 )
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 set(GOOGLE_TEST_SOURCES
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
65 ${GOOGLE_TEST_SOURCES_DIR}/googletest/src/gtest-all.cc
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
66 )
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 # https://code.google.com/p/googletest/issues/detail?id=412
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
69 if (MSVC) # VS2012 does not support tuples correctly yet
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
70 add_definitions(/D _VARIADIC_MAX=10)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
71 endif()
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
72
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
73 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
74 add_definitions(-DGTEST_HAS_CLONE=0)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
75 endif()
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
76
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
77 source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GOOGLE_TEST_SOURCES_DIR}/.*)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
78
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
79 else()
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
80 include(FindGTest)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
81 if (NOT GTEST_FOUND)
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
82 message(FATAL_ERROR "Unable to find GoogleTest")
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
83 endif()
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
84
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
85 include_directories(${GTEST_INCLUDE_DIRS})
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
86
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
87 # The variable GTEST_LIBRARIES contains the shared library of
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
88 # Google Test, create an alias for more uniformity
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
89 set(GOOGLE_TEST_LIBRARIES ${GTEST_LIBRARIES})
8b310d571e5b sync orthanc folder
Alain Mazy <am@osimis.io>
parents:
diff changeset
90 endif()