Mercurial > hg > orthanc
annotate OrthancFramework/UnitTestsSources/CMakeLists.txt @ 5644:343149762476
fix build with DCMTK <= 3.6.6
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 31 May 2024 18:23:44 +0200 |
parents | f7adfb22e20e |
children |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5362
diff
changeset
|
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
7 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
8 # This program is free software: you can redistribute it and/or |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
9 # modify it under the terms of the GNU Lesser General Public License |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
10 # as published by the Free Software Foundation, either version 3 of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
11 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
12 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
13 # This program is distributed in the hope that it will be useful, but |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
14 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
16 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
17 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
18 # You should have received a copy of the GNU Lesser General Public |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
19 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
20 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
21 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4117
diff
changeset
|
22 |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 ## |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 ## This file is meant to be used only by ../SharedLibrary/CMakeLists.txt |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 ## |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 cmake_minimum_required(VERSION 2.8) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 project(UnitTestsProject) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
4094
1c89208fbba9
fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
30 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") |
1c89208fbba9
fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
31 set(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") |
4309
73de065622ec
missing cmake parameters if building unit tests of framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4307
diff
changeset
|
32 |
4094
1c89208fbba9
fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
33 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") |
4309
73de065622ec
missing cmake parameters if building unit tests of framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4307
diff
changeset
|
34 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") |
73de065622ec
missing cmake parameters if building unit tests of framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4307
diff
changeset
|
35 |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 else() |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 endif() |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
4535
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
42 if (ORTHANC_FRAMEWORK_STATIC) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
43 include_directories(${ORTHANC_FRAMEWORK_ROOT}/..) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
44 else() |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
45 include(CheckIncludeFile) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
46 include(CheckIncludeFileCXX) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
47 |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
48 link_libraries(jsoncpp) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
49 |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
50 include(FindLua) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
51 if (NOT LUA_FOUND) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
52 message(FATAL_ERROR "Please install the liblua-dev package") |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
53 endif() |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
54 include_directories(${LUA_INCLUDE_DIR}) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
55 link_libraries(${LUA_LIBRARIES}) |
4496
9ea70ccf0c21
Possibility to generate a static library containing the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
56 |
4535
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
57 check_include_file(sqlite3.h HAVE_SQLITE_H) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
58 if (NOT HAVE_SQLITE_H) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
59 message(FATAL_ERROR "Please install the libsqlite3-dev package") |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
60 endif() |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
61 link_libraries(sqlite3) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
62 |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
63 check_include_file_cxx(pugixml.hpp HAVE_PUGIXML_H) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
64 if (NOT HAVE_PUGIXML_H) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
65 message(FATAL_ERROR "Please install the libpugixml-dev package") |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
66 endif() |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
67 link_libraries(pugixml) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
68 |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
69 find_package(Boost COMPONENTS filesystem thread system date_time iostreams locale regex) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
70 if (NOT Boost_FOUND) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
71 message(FATAL_ERROR "Unable to locate Boost on this system") |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
72 endif() |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
73 link_libraries(${Boost_LIBRARIES}) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
74 |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
75 include(FindDCMTK NO_MODULE) |
c40c1234a696
simplification of DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4531
diff
changeset
|
76 link_libraries(${DCMTK_LIBRARIES}) |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 endif() |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake) |
4094
1c89208fbba9
fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
80 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake) |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 add_definitions( |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 ) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 add_executable(UnitTests |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 ${CMAKE_SOURCE_DIR}/SharedLibraryUnitTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 ${CMAKE_SOURCE_DIR}/DicomMapTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 ${CMAKE_SOURCE_DIR}/FileStorageTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 ${CMAKE_SOURCE_DIR}/FrameworkTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 ${CMAKE_SOURCE_DIR}/FromDcmtkTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 ${CMAKE_SOURCE_DIR}/ImageProcessingTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 ${CMAKE_SOURCE_DIR}/ImageTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 ${CMAKE_SOURCE_DIR}/JobsTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 ${CMAKE_SOURCE_DIR}/JpegLosslessTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 ${CMAKE_SOURCE_DIR}/LoggingTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 ${CMAKE_SOURCE_DIR}/LuaTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 ${CMAKE_SOURCE_DIR}/MemoryCacheTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 ${CMAKE_SOURCE_DIR}/RestApiTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 ${CMAKE_SOURCE_DIR}/SQLiteChromiumTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 ${CMAKE_SOURCE_DIR}/SQLiteTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 ${CMAKE_SOURCE_DIR}/StreamTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 ${CMAKE_SOURCE_DIR}/ToolboxTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 ${CMAKE_SOURCE_DIR}/ZipTests.cpp |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 ${AUTOGENERATED_SOURCES} |
4307
2a9d304b3a82
fix build of Orthanc framework DLL for Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
109 ${BOOST_SOURCES} |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 ${GOOGLE_TEST_SOURCES} |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 ) |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 |
5362
78aad3916da4
added more DefineSourceBasenameForTarget()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
113 DefineSourceBasenameForTarget(UnitTests) |
78aad3916da4
added more DefineSourceBasenameForTarget()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
114 |
4097
99e2054d1e8d
fix unit tests for orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4094
diff
changeset
|
115 target_link_libraries(UnitTests ${ORTHANC_FRAMEWORK_LIBRARIES}) |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 install(TARGETS UnitTests |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 DESTINATION ${ORTHANC_FRAMEWORK_LIBDIR} |
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 ) |