forked from BIC-MNI/minc4itk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
144 lines (108 loc) · 3.77 KB
/
CMakeLists.txt
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# CMakeFiles.txt for the minc4itk module
#
# Vladimir S. FONOV - [email protected]
PROJECT( ITKIOMINC )
cmake_minimum_required(VERSION 2.6)
# either compile as ITKv4 module or a stand-alone library for ITKv3 or ITKv4
SET(ITK_MODULE_BUILD OFF)
if(itk-module)
SET(ITK_MODULE_BUILD ON)
endif(itk-module)
SET(MINC4ITK_EXTERNALLY_CONFIGURED OFF)
IF(MINC_TOOLKIT_BUILD)
SET(ITK_MODULE_BUILD OFF)
SET(MINC4ITK_EXTERNALLY_CONFIGURED ON)
ENDIF(MINC_TOOLKIT_BUILD)
IF(ITK_MODULE_BUILD)
FIND_PACKAGE( LIBMINC REQUIRED )
INCLUDE_DIRECTORIES(${LIBMINC_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBMINC_LIBRARY_DIRS})
SET(MINC4ITK_HEADERS
include/itkMincImageIOFactory.h
include/itkMincImageIO.h
include/itkMincGeneralTransform.h
include/itkMincHelpers.h
include/itkMincTransformIOFactory.h
include/itkMincTransformIO.h
)
SET(ITKIOMINC_LIBRARIES ITKIOMINC ${VOLUME_IO_LIBRARIES} ${EZMINC_LIBRARIES})
itk_module_impl()
ELSE( ITK_MODULE_BUILD )
IF(NOT MINC4ITK_EXTERNALLY_CONFIGURED)
FIND_PACKAGE( LIBMINC REQUIRED )
INCLUDE_DIRECTORIES(${LIBMINC_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBMINC_LIBRARY_DIRS})
FIND_PACKAGE( ITK REQUIRED )
ENDIF(NOT MINC4ITK_EXTERNALLY_CONFIGURED)
# Add include directories needed to use ITK.
INCLUDE_DIRECTORIES(BEFORE ${ITK_INCLUDE_DIRS})
# Add link directories needed to use ITK.
LINK_DIRECTORIES( ${ITK_LIBRARY_DIRS} )
SET( ITKIOMINC_SRC
src/itkMincHelpers.cxx
src/itkMincImageIO.cxx
src/itkMincImageIOFactory.cxx
src/itkMincHelpers.cxx
)
SET( ITKIOMINC_HEADER
include/itkMincImageIO.h
include/itkMincTransformIO.h
include/itkMincGeneralTransform.h
include/itkMincHelpers.h
include/itkMincImageIOFactory.h
)
IF( ITK_VERSION_MAJOR VERSION_EQUAL 4 )
SET(ITKIOMINC_SRC
${ITKIOMINC_SRC}
src/itkMincTransformIO.cxx
src/itkMincTransformIOFactory.cxx
)
SET(ITKIOMINC_HEADER
${ITKIOMINC_HEADER}
include/itkMincTransformIOFactory.h
)
ENDIF(ITK_VERSION_MAJOR VERSION_EQUAL 4)
INCLUDE_DIRECTORIES( ${LIBMINC_INCLUDE_DIRS} include )
LINK_DIRECTORIES( ${LIBMINC_LIBRARY_DIRS} )
ADD_LIBRARY(ITKIOMINC ${ITKIOMINC_SRC} ${ITKIOMINC_HEADER})
TARGET_LINK_LIBRARIES(ITKIOMINC
${EZMINC_LIBRARIES}
${VOLUME_IO_LIBRARIES}
${ITK_LIBRARIES}
${LIBMINC_LIBRARIES}
)
INSTALL(FILES ${ITKIOMINC_HEADER}
DESTINATION include)
INSTALL(TARGETS
ITKIOMINC ${LIBRARY_INSTALL}
DESTINATION lib${LIB_SUFFIX})
SET(MINC4ITK_LIBRARY ITKIOMINC)
set(MINC4ITK_INCLUDE_DIRS_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/include )
set(MINC4ITK_LIBRARY_DIRS_CONFIG ${CMAKE_CURRENT_BINARY_DIR} )
set(MINC4ITK_LIBRARIES_CONFIG
ITKIOMINC
)
configure_file(src/MINC4ITKConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/MINC4ITKConfig.cmake @ONLY )
# config for install dir
set(MINC4ITK_INCLUDE_DIRS_CONFIG
${CMAKE_INSTALL_PREFIX}/include
)
set(MINC4ITK_LIBRARY_DIRS_CONFIG ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} )
set(MINC4ITK_LIBRARIES_CONFIG
ITKIOMINC
)
#fix for superbuild install
IF(SUPERBUILD_STAGING_PREFIX)
STRING(REPLACE "${SUPERBUILD_STAGING_PREFIX}" "" MINC4ITK_LIBRARY_DIRS_CONFIG "${MINC4ITK_LIBRARY_DIRS_CONFIG}")
STRING(REPLACE "${SUPERBUILD_STAGING_PREFIX}" "" MINC4ITK_INCLUDE_DIRS_CONFIG "${MINC4ITK_INCLUDE_DIRS_CONFIG}")
STRING(REPLACE "${SUPERBUILD_STAGING_PREFIX}" "" MINC4ITK_LIBRARIES_CONFIG "${MINC4ITK_LIBRARIES_CONFIG}")
ENDIF(SUPERBUILD_STAGING_PREFIX)
configure_file(src/MINC4ITKConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MINC4ITKConfig.cmake @ONLY )
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MINC4ITKConfig.cmake
DESTINATION lib${LIB_SUFFIX}
COMPONENT Development)
ENDIF(ITK_MODULE_BUILD)