File: CMakeLists.txt

package info (click to toggle)
insighttoolkit4 4.13.3withdata-dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 489,260 kB
  • sloc: cpp: 557,342; ansic: 146,850; fortran: 34,788; python: 16,572; sh: 2,187; lisp: 2,070; tcl: 993; java: 362; perl: 200; makefile: 129; csh: 81; pascal: 69; xml: 19; ruby: 10
file content (92 lines) | stat: -rw-r--r-- 3,134 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# This project builds the test directories from all ITK modules as a separate
# project outside the main ITK build tree as if they were an application.
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)

foreach(p
    CMP0025 # CMake 3.0
    CMP0042 # CMake 3.0
    CMP0054 # CMake 3.1
    CMP0056 # CMake 3.2
    CMP0058 # CMake 3.3
    )
  if(POLICY ${p})
    cmake_policy(SET ${p} NEW)
  endif()
endforeach()

project(ITKTestExternal)
if(ITK_SOURCE_DIR OR ITK_BINARY_DIR)
  message(FATAL_ERROR "This directory may build only outside ITK!")
endif()

include(CTest)

# Find the top of the main ITK source tree.
get_filename_component(ITK_TOP_DIR ${ITKTestExternal_SOURCE_DIR}/../.. ABSOLUTE)
set(ExternalData_SOURCE_ROOT ${ITK_TOP_DIR})

# Load module infrastructure macros.
include(${ITK_TOP_DIR}/CMake/ITKModuleMacros.cmake)
include(${ITK_TOP_DIR}/CMake/ITKExternalData.cmake)
include(${ITK_TOP_DIR}/CMake/ITKModuleTest.cmake)

# Tell modules how to add their tests.
function(itk_add_test)
  # Add tests with data in the ITKData group.
  ExternalData_add_test(ITKData ${ARGN})
endfunction()

# Find the ITK build or install tree.  Assume the version matches exactly.
# One should provide ITK_DIR explicitly in our intended use cases.
find_package(ITK REQUIRED NO_MODULE)

# Use ITK's flags.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ITK_REQUIRED_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ITK_REQUIRED_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}")

# This is a cross-platform project so we cannot use the MS _s API.
if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
  set(_INTEL_WINDOWS 1)
endif()
if(MSVC OR _INTEL_WINDOWS)
  add_definitions(
    -D_CRT_NONSTDC_NO_DEPRECATE
    -D_CRT_SECURE_NO_DEPRECATE
    -D_SCL_SECURE_NO_DEPRECATE
    )
endif()

# Glob the set modules in the source tree.
file(GLOB meta RELATIVE "${ITK_TOP_DIR}"
   "${ITK_TOP_DIR}/*/*/*/itk-module.cmake" # grouped modules
  )
# Identify the subset of modules that have tests.
foreach(f ${meta})
  get_filename_component(_base ${f} PATH)
  if(EXISTS ${ITK_TOP_DIR}/${_base}/test)
    include(${ITK_TOP_DIR}/${f})
    set(${itk-module}_TEST_DIR ${_base}/test)
    unset(itk-module)
  endif()
endforeach()

# Input information for test build files.
set(ITK_DATA_ROOT ${ITK_TOP_DIR}/Testing/Data)
set(ITK_EXAMPLE_DATA_ROOT ${ITK_TOP_DIR}/Examples/Data)
set(ITK_TEST_OUTPUT_DIR "${ITKTestExternal_BINARY_DIR}/Testing/Temporary")

# Add the test directory for each enabled module that has tests.
foreach(itk-module ${ITK_MODULES_ENABLED})
  if(${itk-module}_TEST_DIR)
    add_subdirectory(${ITK_TOP_DIR}/${${itk-module}_TEST_DIR}
                     ${ITKTestExternal_BINARY_DIR}/${${itk-module}_TEST_DIR})
  endif()
endforeach()


# Create target to download data from the ITKData group.  This must come after
# all tests have been added that reference the group, so we put it last.
ExternalData_Add_Target(ITKData)