annotate OrthancFramework/UnitTestsSources/CMakeLists.txt @ 4492:0b2484663233

Fix build on big-endian architectures
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 30 Jan 2021 18:19:11 +0100
parents d9473bd5ed43
children 9ea70ccf0c21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4309
diff changeset
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
5 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
6 # 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
7 # 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
8 # 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
9 # the License, or (at your option) any later version.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
10 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
11 # 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
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
13 # 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
14 # Lesser General Public License for more details.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
15 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
16 # 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
17 # License along with this program. If not, see
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
18 # <http://www.gnu.org/licenses/>.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
19
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4117
diff changeset
20
4063
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 ##
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 ## 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
23 ##
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 cmake_minimum_required(VERSION 2.8)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 project(UnitTestsProject)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
4094
1c89208fbba9 fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4063
diff changeset
28 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
1c89208fbba9 fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4063
diff changeset
29 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
30 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
31
4094
1c89208fbba9 fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4063
diff changeset
32 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
33 set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
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
73de065622ec missing cmake parameters if building unit tests of framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4307
diff changeset
36 set(BOOST_LOCALE_BACKEND "libiconv" CACHE STRING "Back-end for locales that is used by Boost (can be \"gcc\", \"libiconv\", \"icu\", or \"wconv\" on Windows)")
4117
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
37 set(USE_CXX11 OFF CACHE BOOL "Whether to enable compiler support for C++11")
4063
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 else()
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 endif()
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 if (NOT ORTHANC_FRAMEWORK_STATIC)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 set(ENABLE_DCMTK ON)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 set(ENABLE_LUA ON)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 set(ENABLE_PUGIXML ON)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 set(ENABLE_SQLITE ON)
4097
99e2054d1e8d fix unit tests for orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4094
diff changeset
50
99e2054d1e8d fix unit tests for orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4094
diff changeset
51 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
99e2054d1e8d fix unit tests for orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4094
diff changeset
52 else()
99e2054d1e8d fix unit tests for orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4094
diff changeset
53 set(USE_SYSTEM_GOOGLE_TEST OFF CACHE INTERNAL "")
4063
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 endif()
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 set(ENABLE_GOOGLE_TEST ON)
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake)
4307
2a9d304b3a82 fix build of Orthanc framework DLL for Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4120
diff changeset
58 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/BoostConfiguration.cmake)
4094
1c89208fbba9 fix build of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4063
diff changeset
59 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake)
4063
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
4117
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
61 if (USE_CXX11)
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
62 if (CMAKE_COMPILER_IS_GNUCXX)
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
63 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
64 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
65 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
66 endif()
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
67 endif()
9286649df279 use of C++11 in the unit tests of the shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4097
diff changeset
68
4063
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 add_definitions(
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 -DORTHANC_BUILD_UNIT_TESTS=1 # For "HierarchicalZipWriter" tests
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 )
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 add_executable(UnitTests
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 ${CMAKE_SOURCE_DIR}/SharedLibraryUnitTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ${CMAKE_SOURCE_DIR}/DicomMapTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 ${CMAKE_SOURCE_DIR}/FileStorageTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 ${CMAKE_SOURCE_DIR}/FrameworkTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 ${CMAKE_SOURCE_DIR}/FromDcmtkTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 ${CMAKE_SOURCE_DIR}/ImageProcessingTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 ${CMAKE_SOURCE_DIR}/ImageTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 ${CMAKE_SOURCE_DIR}/JobsTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 ${CMAKE_SOURCE_DIR}/JpegLosslessTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 ${CMAKE_SOURCE_DIR}/LoggingTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 ${CMAKE_SOURCE_DIR}/LuaTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 ${CMAKE_SOURCE_DIR}/MemoryCacheTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 ${CMAKE_SOURCE_DIR}/RestApiTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 ${CMAKE_SOURCE_DIR}/SQLiteChromiumTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 ${CMAKE_SOURCE_DIR}/SQLiteTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 ${CMAKE_SOURCE_DIR}/StreamTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 ${CMAKE_SOURCE_DIR}/ToolboxTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 ${CMAKE_SOURCE_DIR}/ZipTests.cpp
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 ${AUTOGENERATED_SOURCES}
4307
2a9d304b3a82 fix build of Orthanc framework DLL for Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4120
diff changeset
96 ${BOOST_SOURCES}
4063
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 ${GOOGLE_TEST_SOURCES}
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 )
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
4097
99e2054d1e8d fix unit tests for orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4094
diff changeset
100 target_link_libraries(UnitTests ${ORTHANC_FRAMEWORK_LIBRARIES})
4063
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 install(TARGETS UnitTests
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 DESTINATION ${ORTHANC_FRAMEWORK_LIBDIR}
e00f3d089991 shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 )