view OrthancFramework/UnitTestsSources/CMakeLists.txt @ 4339:fc5caed6f940

"/tools/dicom-echo": Execute C-Echo SCU to a modality that is not registered in "/modalities"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 03 Dec 2020 11:47:03 +0100
parents 73de065622ec
children d9473bd5ed43
line wrap: on
line source

# Orthanc - A Lightweight, RESTful DICOM Store
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2020 Osimis S.A., Belgium
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.


##
## This file is meant to be used only by ../SharedLibrary/CMakeLists.txt
##

cmake_minimum_required(VERSION 2.8)
project(UnitTestsProject)

set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
set(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests")

set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
set(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")

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)")
set(USE_CXX11 OFF CACHE BOOL "Whether to enable compiler support for C++11")

if (UNIT_TESTS_WITH_HTTP_CONNEXIONS)
  add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1)
else()
  add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0)
endif()

if (NOT ORTHANC_FRAMEWORK_STATIC)
  set(ENABLE_DCMTK ON)
  set(ENABLE_LUA ON)
  set(ENABLE_PUGIXML ON)
  set(ENABLE_SQLITE ON)

  set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
else()
  set(USE_SYSTEM_GOOGLE_TEST OFF CACHE INTERNAL "")
endif()
  
set(ENABLE_GOOGLE_TEST ON)
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake)
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/BoostConfiguration.cmake)
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake)

if (USE_CXX11)
  if (CMAKE_COMPILER_IS_GNUCXX)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
  elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  endif()
endif()

add_definitions(
  -DORTHANC_UNIT_TESTS_LINK_FRAMEWORK=1
  -DORTHANC_BUILD_UNIT_TESTS=1  # For "HierarchicalZipWriter" tests
  )

add_executable(UnitTests
  ${CMAKE_SOURCE_DIR}/SharedLibraryUnitTests.cpp

  ${CMAKE_SOURCE_DIR}/DicomMapTests.cpp
  ${CMAKE_SOURCE_DIR}/FileStorageTests.cpp
  ${CMAKE_SOURCE_DIR}/FrameworkTests.cpp
  ${CMAKE_SOURCE_DIR}/FromDcmtkTests.cpp
  ${CMAKE_SOURCE_DIR}/ImageProcessingTests.cpp
  ${CMAKE_SOURCE_DIR}/ImageTests.cpp
  ${CMAKE_SOURCE_DIR}/JobsTests.cpp
  ${CMAKE_SOURCE_DIR}/JpegLosslessTests.cpp
  ${CMAKE_SOURCE_DIR}/LoggingTests.cpp
  ${CMAKE_SOURCE_DIR}/LuaTests.cpp
  ${CMAKE_SOURCE_DIR}/MemoryCacheTests.cpp
  ${CMAKE_SOURCE_DIR}/RestApiTests.cpp
  ${CMAKE_SOURCE_DIR}/SQLiteChromiumTests.cpp
  ${CMAKE_SOURCE_DIR}/SQLiteTests.cpp
  ${CMAKE_SOURCE_DIR}/StreamTests.cpp
  ${CMAKE_SOURCE_DIR}/ToolboxTests.cpp
  ${CMAKE_SOURCE_DIR}/ZipTests.cpp

  ${AUTOGENERATED_SOURCES}
  ${BOOST_SOURCES}
  ${GOOGLE_TEST_SOURCES}
  )

target_link_libraries(UnitTests ${ORTHANC_FRAMEWORK_LIBRARIES})

install(TARGETS UnitTests
  DESTINATION ${ORTHANC_FRAMEWORK_LIBDIR}
  )