view OrthancStone/UnitTestsSources/CMakeLists.txt @ 2104:5653b6335642

migration to UCLouvain servers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Nov 2023 07:43:13 +0100
parents 07964689cb0b
children 352cb0fa57b2
line wrap: on
line source

# Stone of Orthanc
# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
# Department, University Hospital of Liege, Belgium
# Copyright (C) 2017-2023 Osimis S.A., Belgium
# Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, 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/>.


cmake_minimum_required(VERSION 2.8.10)
cmake_policy(SET CMP0058 NEW)

project(UnitTests)

set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
include(${CMAKE_SOURCE_DIR}/../Resources/CMake/OrthancStoneParameters.cmake)

if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
  set(ORTHANC_BOOST_COMPONENTS program_options)

  set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
  set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
  mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
  include(${ORTHANC_STONE_ROOT}/../Resources/Orthanc/CMake/DownloadPackage.cmake)
  include(${ORTHANC_STONE_ROOT}/../Resources/Orthanc/CMake/GoogleTestConfiguration.cmake)

else()
  set(ENABLE_GOOGLE_TEST ON)
endif()

set(ENABLE_OPENGL OFF)
set(ENABLE_PUGIXML ON)

include(${ORTHANC_STONE_ROOT}/../Resources/CMake/OrthancStoneConfiguration.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/UnitTestsSources.cmake)

EmbedResources(
  RT_STRUCT_00 ${CMAKE_CURRENT_SOURCE_DIR}/TestStructureSet.json
  )

add_executable(UnitTests
  ${UNIT_TESTS_SOURCES}
  ${AUTOGENERATED_SOURCES}
  ${BOOST_EXTENDED_SOURCES}
  ${GOOGLE_TEST_SOURCES}
  ${ORTHANC_STONE_SOURCES}
  )

DefineSourceBasenameForTarget(UnitTests)

add_custom_command(
  TARGET UnitTests
  POST_BUILD
  COMMAND ${CMAKE_COMMAND} -E copy
    "${CMAKE_SOURCE_DIR}/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json" 
    "$<TARGET_FILE_DIR:UnitTests>/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json"
)


#####################################################################
## Generate the documentation if Doxygen is present
#####################################################################

find_package(Doxygen)
if (DOXYGEN_FOUND)
  configure_file(
    ${ORTHANC_STONE_ROOT}/../Resources/OrthancStone.doxygen
    ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
    @ONLY)

  add_custom_target(doc
    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
    COMMENT "Generating documentation with Doxygen" VERBATIM
    )
else()
  message("Doxygen not found. The documentation will not be built.")
endif()