view OrthancFramework/UnitTestsSources/CMakeLists.txt @ 4094:1c89208fbba9

fix build of orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jun 2020 17:00:18 +0200
parents e00f3d089991
children 99e2054d1e8d
line wrap: on
line source

##
## 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_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")

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)
endif()
  
set(ENABLE_GOOGLE_TEST ON)
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DownloadOrthancFramework.cmake)
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/GoogleTestConfiguration.cmake)
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/JsonCppConfiguration.cmake)

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}
  ${GOOGLE_TEST_SOURCES}
  )

target_link_libraries(UnitTests OrthancFramework)
set_target_properties(UnitTests PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
set_target_properties(UnitTests PROPERTIES INSTALL_RPATH ${ORTHANC_FRAMEWORK_LIBDIR})

install(TARGETS UnitTests
  DESTINATION ${ORTHANC_FRAMEWORK_LIBDIR}
  )