annotate Resources/Orthanc/CMake/GoogleTestConfiguration.cmake @ 251:ed12248ad791

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