CamiTKExtension.cmake 67 KB
Newer Older
promayon's avatar
promayon committed
1
2
3
4
5
6
7
8
9
10
11
12
#!
#! \addtogroup CamiTKMacros
#!
#! Macro camitk_extension simplifies writing a camitk extension (component, action)
#!
#! The name of the extension is automatically the name of the directory from where this macro
#! is called, unless it is overriden by the TARGET_NAME parameter.
#!
#!  usage:
#! \code
#!    extension(<type>
#!                     [DISABLED]
13
#!                     [NEEDS_QT_MODULES]
promayon's avatar
promayon committed
14
15
16
17
18
#!                     [NEEDS_ITK]
#!                     [NEEDS_LIBXML2]
#!                     [NEEDS_OPENCV]
#!                     [NEEDS_IGSTK]
#!                     [NEEDS_XSD]
19
#!                     [NEEDS_GDCM]
20
#!                     [NEEDS_ACTION_EXTENSION action1 action2 ...]
promayon's avatar
promayon committed
21
#!                     [NEEDS_COMPONENT_EXTENSION component1 component2 ...]
22
#!                     [NEEDS_CEP_LIBRARIES CEPLib1 CEPLib2 ...]
promayon's avatar
promayon committed
23
24
25
#!                     [INCLUDE_DIRECTORIES dir1 dir2 ...]
#!                     [DEFINES flag1 flag2 ...]
#!                     [EXTERNAL_SOURCES file1 file2 ...]
26
#!                     [EXTERNAL_LIBRARIES lib1 lib2 ...]
promayon's avatar
promayon committed
27
28
29
30
31
32
33
34
35
#!                     [HEADERS_TO_INSTALL header1.h header2.h ...]
#!                     [INSTALL_ALL_HEADERS]
#!                     [TARGET_NAME non-default-targetname]
#!     )
#! \endcode
#!
#! \param <type>                    = The selected type of extension you wish to build.
#                                     possible values : ACTION_EXTENSION or COMPONENT_EXTENSION.
#! \param DISABLED                  = means this is a not a default extension, it will not be compiled automatically
36
#! \param NEEDS_QT_MODULES          = add this if your library depends on Qt modules, such as QtCore, QtGui, QtMultimedia, QtNetwork, QtOpenGL, QtScript, QtScriptTools, QtSql, QtSvg, QtWebkit, QtXml, QtXmlPatterns, QtDeclarative
promayon's avatar
promayon committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! \param NEEDS_ITK                 = add this if your component needs itk.
#!                                    Do not forget to add the needed list of itk libraries in the LIBRARIES parameter
#! \param NEEDS_LIBXML2             = add this if your component needs libxml2
#! \param NEEDS_XSD                 = add this if your action needs Codesynthesis xsd cxx (xml schema compiler)
#! \param NEEDS_OPENCV              = add this if your component needs OpenCV
#! \param NEEDS_IGSTK               = add this if your component needs IgsTK
#! \param NEEDS_XERCESC             = add this if your action / component needs XercesC library
#! \param NEEDS_CEP_LIBRARIES       = list of needed CEP libraries (not external dependencies)
#! \param NEEDS_COMPONENT_EXTENSION = list of needed component extensions
#! \param NEEDS_ACTION_EXTENSION    = list of needed component extensions
#! \param INCLUDE_DIRECTORIES       = additional include directories
#! \param DEFINES                   = list of define flags to add at compilation time
#! \param EXTERNAL_SOURCES          = list of extra source/headers files (external to the current directory)
#!                                    that needed to be added to the SOURCES variable.
#!                                    Note: EXTERNAL_SOURCES are not installed
52
#! \param EXTERNAL_LIBRARIES        = external libraries to add to the link command
promayon's avatar
promayon committed
53
54
55
56
57
58
59
60
61
62
#! \param HEADERS_TO_INSTALL        = list of headers to install, if present this will automatically
#!                                    create an "install-COMPONENT_NAMEcomponent" target, that can be used
#!                                    anywhere else to manage dependencies to this component.
#!                                    The headers are installed ${CAMITK_BUILD_INCLUDE_DIR}/COMPONENT_NAME
#!                                    when the target "install-COMPONENT_NAMEcomponent" is called.
#! \param INSTALL_ALL_HEADERS       = install all of the headers (this is the lazy solution, please consider
#!                                    making a list and using HEADERS_TO_INSTALL parameter instead!
#! \param TARGET_NAME               = specify a target name different than the default (default is the action/component directory name)
#!                                    this can be very useful for example when you have action/component directory in your CEP that has
#!                                    the same name as one in the camitk opensource.
63
64
65
#! \param CEP_NAME                  = specify the CEP_NAME, which is used to categorized the extension for packaging purpose
#!                                    No CEP_NAME provided will result in default categorization (generic extension).
#! \param DESCRIPTION               = Simple description of the extension. Used for packaging presentation for instance.
66
#! \param NEEDS_GDCM                = Add this, if your extension requires GDCM 2.x library
promayon's avatar
promayon committed
67
68
macro(camitk_extension)

69
70
71
72
73
74
75
76
77
78
79
80
    #########################################################################
    #                                                                       #
    #   ARGUMENTS PARSING                                                   #
    #                                                                       #
    #   * Use a macro to create the CMAKE variables according to the        #
    #     provided options as input.                                        #
    #                                                                       #
    #########################################################################

    get_directory_name(${CMAKE_CURRENT_SOURCE_DIR} EXTENSION_NAME)

    parse_arguments(${EXTENSION_NAME_CMAKE} #prefix
81
82
        "NEEDS_TOOL;NEEDS_CEP_LIBRARIES;NEEDS_COMPONENT_EXTENSION;NEEDS_ACTION_EXTENSION;INCLUDE_DIRECTORIES;EXTERNAL_LIBRARIES;HEADERS_TO_INSTALL;DEFINES;EXTERNAL_SOURCES;TARGET_NAME;CEP_NAME;DESCRIPTION;TEST_APPLICATION"  # possible lists
        "NEEDS_QT_MODULES;ACTION_EXTENSION;COMPONENT_EXTENSION;DISABLED;NEEDS_XERCESC;NEEDS_ITK;NEEDS_LIBXML2;NEEDS_XSD;NEEDS_QTXML;NEEDS_OPENCV;NEEDS_IGSTK;INSTALL_ALL_HEADERS;NEEDS_GDCM;" # possible options
83
84
        ${ARGN}
    )
85
86
    
    
promayon's avatar
promayon committed
87

88
89
90
91
    #########################################################################
    #                                                                       #
    #   CREATE CMAKE VARIABLES                                              #
    #                                                                       #
92
    #   * Create required and useful CMake variables for the macro          #
93
94
95
96
97
    #                                                                       #
    #########################################################################
    
    # TYPE EXTENSION : ACTION or COMPONENT
    if (${EXTENSION_NAME_CMAKE}_ACTION_EXTENSION)
promayon's avatar
promayon committed
98
99
        set(TYPE_EXTENSION "action")
        string(TOUPPER ${TYPE_EXTENSION} TYPE_EXTENSION_CMAKE)
100
    elseif(${EXTENSION_NAME_CMAKE}_COMPONENT_EXTENSION)
promayon's avatar
promayon committed
101
102
103
104
        set(TYPE_EXTENSION "component")
        string(TOUPPER ${TYPE_EXTENSION} TYPE_EXTENSION_CMAKE)
    endif()

105
106
107
108
109
110
111
112
    # CMAKE CACHE VARIABLE
    # if it is the first cmake run, create the extension variable with a correct initial value
    if(NOT ${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_INTERNAL)
        # add option to enable/disable this extension and set it to true by default
        # Building the extension can be disabled by giving the argument DISABLED to the macro
        # or by passing the flag -D${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_DISABLED:BOOL=TRUE
        if(${EXTENSION_NAME_CMAKE}_DISABLED)
            set(${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_ENABLED FALSE)
113
        else()
114
            set(${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_ENABLED TRUE)
115
        endif()
116
117
        set(${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE} ${${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_ENABLED} CACHE BOOL "Build extension ${EXTENSION_NAME}")
        set(${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_INTERNAL TRUE CACHE INTERNAL "Is variable ${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME} already created?")
promayon's avatar
promayon committed
118
119
    endif()

120
121
122
123
124
125
126
127
128
129
  # if this extension is enabled, do everything needed
  # otherwise... do nothing
    if (${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE})

        # TARGET NAME
        # The target name is composed of the following: [action / component]-name
        # * action / component is the type of extension as prefix
        # * name is deduced from the input folder containing the calling CMakeLists.txt file of the extension.
        if (${EXTENSION_NAME_CMAKE}_TARGET_NAME)
            set(${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME ${${EXTENSION_NAME_CMAKE}_TARGET_NAME})
130
        else()
131
            set(${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME ${EXTENSION_NAME})
132
        endif()
133
134
135
136
137
138
139
140
141
        # replace "-" by "_" if the extension is being packaged with NSIS, the program to create a Windows installer.
        if (PACKAGING_NSIS)
            # NSIS requires that cpack component names do not feature space or "-" characters
            set(${TYPE_EXTENSION_CMAKE}_TARGET_NAME ${TYPE_EXTENSION}_${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME})
        else()
            set(${TYPE_EXTENSION_CMAKE}_TARGET_NAME ${TYPE_EXTENSION}-${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME})
        endif()
        
        message(STATUS "Building extension ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}")
142
143
144
145
146
147
148
149
150
151
152
153
        
        
        
        #########################################################################
        #                                                                       #
        #   INCLUDE DIRECTORIES                                                 #
        #                                                                       #
        #   * Include basic directories where to look header files              #
        #   * Include also additional user provided directories                 #
        #   * These directories are used for compilation step                   #
        #                                                                       #
        #########################################################################
154
155
        # BASIC DIRECTORIES

156
        include_directories(${CAMITK_INCLUDE_DIRECTORIES})
157
158
        include_directories(${CMAKE_CURRENT_BINARY_DIR})
        include_directories(${CMAKE_CURRENT_SOURCE_DIR})
159
160
        
        # USER INPUT DIRECTORIES
161
        include_directories(${${EXTENSION_NAME_CMAKE}_INCLUDE_DIRECTORIES})
162
163
164
165
166
167
168
169
170
171
172
173
174
        
        
        
        #########################################################################
        #                                                                       #
        #   GATHER RESSOURCES                                                   #
        #                                                                       #
        #   * Get all the headers (.h) and source files (.cpp) of the project   #
        #   * Create the needed Qt files (using moc and uic)                    #
        #                                                                       #
        #########################################################################
        
        # get all headers, sources and do what is needed for Qt
175
176
177
178
        # one need to do this just before the add_library so that all defines, include directories and link directories
        # are set properly (gather_headers_and_sources include the call to Qt moc and uic)
        gather_headers_and_sources(${EXTENSION_NAME_CMAKE})

179
180
181
182
183
184
185
186
187
188
189
190
        
        
        #########################################################################
        #                                                                       #
        #   ADDITIONAL KNOWN LIBRARY DEPENDENCIES                               #
        #                                                                       #
        #   * Look for specific library needed                                  #
        #   * Specific libraries are specified as option with the               #
        #     NEEDS_LIBRARY syntax (see macro syntax for more options)          #
        #   * Backward compatibility : Warn user if using old NEEDS_TOOL syntax #
        #                                                                       #
        #########################################################################
191

192
        # Looking for ITK
193
        set(ITK_LIBRARIES "")
194
195
        if(${EXTENSION_NAME_CMAKE}_NEEDS_ITK) # ITK is required
            if (MSVC) # Visual Studio compiler
196
197
                if(MSVC90 OR MSVC10) # Visual Studion 2008/2010 => use ITK 3.20.1
                    find_package(ITK REQUIRED) 
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
                    if(ITK_FOUND)
                        message(STATUS "${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} : Found suitable version of ITK : ${ITK_VERSION} (required is 3.20.1)")
                        include(${ITK_USE_FILE})
                        set(ITK_LIBRARIES
                            debug ITKBasicFilters${CAMITK_DEBUG_POSTFIX}
                            optimized ITKBasicFilters
                            debug ITKCommon${CAMITK_DEBUG_POSTFIX}
                            optimized ITKCommon
                            debug ITKIO${CAMITK_DEBUG_POSTFIX}
                            optimized ITKIO
                            debug ITKNrrdIO${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcm${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkjpeg12${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkjpeg16${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkopenjpeg${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkpng${CAMITK_DEBUG_POSTFIX}.lib
                            debug itktiff${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkjpeg8${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKSpatialObject${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvnl_inst${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvnl_algo${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkv3p_netlib${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvnl${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvcl${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkv3p_lsqr${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKMetaIO${CAMITK_DEBUG_POSTFIX}.lib
                            debug itksys${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKDICOMParser${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKEXPAT${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKniftiio${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKznz${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkzlib${CAMITK_DEBUG_POSTFIX}.lib
                            debug snmpapi.lib
                            debug rpcrt4.lib
                            debug ws2_32.lib
                            debug comctl32.lib
                            debug wsock32.lib
                            debug opengl32.lib
                        )
                    else()
                        message(FATAL_ERROR "ITK ( >= 3.20.1) is required by ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}")
                    endif()
                elseif(MSVC11) # Visual Studion 2012 => use ITK 4.3.2 at least
                    find_package(ITK 4.3.2 REQUIRED)
                    if(ITK_FOUND)
                        message(STATUS "${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} : Found suitable version of ITK : ${ITK_VERSION} (required is 4.3.2)")
                        include(${ITK_USE_FILE})
                        link_directories(${ITK_DIR}/../..)
                        set(ITK_LIBRARIES
                            # Debug libraries
                            debug ITKCommon-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKNrrdIO-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmCommon-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkjpeg-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkopenjpeg-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkpng-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itktiff-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKSpatialObjects-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvnl_algo-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkv3p_netlib-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvnl-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvcl-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkv3p_lsqr-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKMetaIO-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itksys-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKDICOMParser-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKEXPAT-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKniftiio-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKznz-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkzlib-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug snmpapi.lib
                            debug rpcrt4.lib
                            debug ws2_32.lib
                            debug comctl32.lib
                            debug wsock32.lib
                            debug opengl32.lib
                            debug ITKIOGIPL-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIONIFTI-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIONRRD-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOPNG-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmDICT-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmDSED-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmIOD-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmjpeg8-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmjpeg12-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmjpeg16-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkgdcmMSFF-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKgiftiio-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkhdf5_cpp-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkhdf5-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKMetaIO-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOBioRad-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOStimulate-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOTIFF-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOVTK-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOPNG-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKBiasCorrection-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKBioCell-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKFEM-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOBMP-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOCSV-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOGDCM-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOGE-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOGIPL-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOHDF5-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOImageBase-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOIPL-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOJPEG-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOLSM-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOMesh-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOMeta-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOSiemens-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOSpatialObjects-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOTransformBase-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOTransformHDF5-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOTransformInsightLegacy-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOTransformMatlab-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKIOXML-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKKLMRegionGrowing-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKLabelMap-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKMesh-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKMetaIO-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkNetlibSlatec-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkopenjpeg-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKOptimizers-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKOptimizersv4-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKPath-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkpng-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKPolynomials-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKQuadEdgeMesh-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKReview-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKStatistics-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkv3p_lsqr-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkv3p_netlib-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug itkvcl-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKVideoCore-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKVideoIO-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKVTK-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKVNLInstantiation-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            debug ITKWatersheds-4.3${CAMITK_DEBUG_POSTFIX}.lib
338
339
                            # Release librariesdebug
                            optimized ITKCommon-4.3.lib
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
                            optimized ITKNrrdIO-4.3.lib
                            optimized itkgdcmCommon-4.3.lib
                            optimized itkjpeg-4.3.lib
                            optimized itkopenjpeg-4.3.lib
                            optimized itkpng-4.3.lib
                            optimized itktiff-4.3.lib
                            optimized ITKSpatialObjects-4.3.lib
                            optimized itkvnl_algo-4.3.lib
                            optimized itkv3p_netlib-4.3.lib
                            optimized itkvnl-4.3.lib
                            optimized itkvcl-4.3.lib
                            optimized itkv3p_lsqr-4.3.lib
                            optimized ITKMetaIO-4.3.lib
                            optimized itksys-4.3.lib
                            optimized ITKDICOMParser-4.3.lib
                            optimized ITKEXPAT-4.3.lib
                            optimized ITKniftiio-4.3.lib
                            optimized ITKznz-4.3.lib
                            optimized itkzlib-4.3.lib
                            optimized snmpapi.lib
                            optimized rpcrt4.lib
                            optimized ws2_32.lib
                            optimized comctl32.lib
                            optimized wsock32.lib
                            optimized opengl32.lib
                            optimized ITKIOGIPL-4.3.lib
                            optimized ITKIONIFTI-4.3.lib
                            optimized ITKIONRRD-4.3.lib
                            optimized ITKIOPNG-4.3.lib
                            optimized itkgdcmDICT-4.3.lib
                            optimized itkgdcmDSED-4.3.lib
                            optimized itkgdcmIOD-4.3.lib
                            optimized itkgdcmjpeg8-4.3.lib
                            optimized itkgdcmjpeg12-4.3.lib
                            optimized itkgdcmjpeg16-4.3.lib
                            optimized itkgdcmMSFF-4.3.lib
                            optimized ITKgiftiio-4.3.lib
                            optimized itkhdf5_cpp-4.3.lib
                            optimized itkhdf5-4.3.lib
                            optimized ITKMetaIO-4.3.lib
                            optimized ITKIOBioRad-4.3.lib
                            optimized ITKIOStimulate-4.3.lib
                            optimized ITKIOTIFF-4.3.lib
                            optimized ITKIOVTK-4.3.lib
                            optimized ITKIOPNG-4.3.lib
                            optimized ITKBiasCorrection-4.3.lib
                            optimized ITKBioCell-4.3.lib
                            optimized ITKFEM-4.3.lib
                            optimized ITKIOBMP-4.3.lib
                            optimized ITKIOCSV-4.3.lib
                            optimized ITKIOGDCM-4.3.lib
                            optimized ITKIOGE-4.3.lib
                            optimized ITKIOGIPL-4.3.lib
                            optimized ITKIOHDF5-4.3.lib
                            optimized ITKIOImageBase-4.3.lib
                            optimized ITKIOIPL-4.3.lib
                            optimized ITKIOJPEG-4.3.lib
                            optimized ITKIOLSM-4.3.lib
                            optimized ITKIOMesh-4.3.lib
                            optimized ITKIOMeta-4.3.lib
                            optimized ITKIOSiemens-4.3.lib
                            optimized ITKIOSpatialObjects-4.3.lib
                            optimized ITKIOTransformBase-4.3.lib
                            optimized ITKIOTransformHDF5-4.3.lib
                            optimized ITKIOTransformInsightLegacy-4.3.lib
                            optimized ITKIOTransformMatlab-4.3.lib
                            optimized ITKIOXML-4.3.lib
                            optimized ITKKLMRegionGrowing-4.3.lib
                            optimized ITKLabelMap-4.3.lib
                            optimized ITKMesh-4.3.lib
                            optimized ITKMetaIO-4.3.lib
                            optimized itkNetlibSlatec-4.3.lib
                            optimized itkopenjpeg-4.3.lib
                            optimized ITKOptimizers-4.3.lib
                            optimized ITKOptimizersv4-4.3.lib
                            optimized ITKPath-4.3.lib
                            optimized itkpng-4.3.lib
                            optimized ITKPolynomials-4.3.lib
                            optimized ITKQuadEdgeMesh-4.3.lib
                            optimized ITKReview-4.3.lib
                            optimized ITKStatistics-4.3.lib
                            optimized itkv3p_lsqr-4.3.lib
                            optimized itkv3p_netlib-4.3.lib
                            optimized itkvcl-4.3.lib
                            optimized ITKVideoCore-4.3.lib
                            optimized ITKVideoIO-4.3.lib
                            optimized ITKVTK-4.3.lib
                            optimized ITKVNLInstantiation-4.3.lib
                            optimized ITKWatersheds-4.3.lib
                        )
                    else()
431
                        message(FATAL_ERROR "ITK ( >= 4.3.2) is required by ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}")
432
433
434
435
                    endif()
                else() # New version of VS compiler not supported yet
                    message(FATAL_ERROR "ITK : Unsupported version of Visual Studio compiler. Please update CamiTK, downgrade your VS version to 2008/2010/2012 or contact CamiTK team support.")
                endif()
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
            else()  
                if (MINGW)  # MinGW compiler
                    find_package(ITK 4.3.2 REQUIRED)
                    if(ITK_FOUND)
                        message(STATUS "${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} : Found suitable version of ITK : ${ITK_VERSION} (required is 4.3.2)")
                        include(${ITK_USE_FILE})
                        link_directories(${ITK_DIR}/../..)
                        set(ITK_LIBRARIES
                            ITKCommon-4.3
                            ITKNrrdIO-4.3
                            itkgdcmCommon-4.3
                            itkjpeg-4.3
                            itkopenjpeg-4.3
                            itkpng-4.3
                            itktiff-4.3
                            ITKSpatialObjects-4.3
                            itkvnl_algo-4.3
                            itkv3p_netlib-4.3
                            itkvnl-4.3
                            itkvcl-4.3
                            itkv3p_lsqr-4.3
                            ITKMetaIO-4.3
                            itksys-4.3
                            ITKDICOMParser-4.3
                            ITKEXPAT-4.3
                            ITKniftiio-4.3
                            ITKznz-4.3
                            itkzlib-4.3
                            snmpapi
                            rpcrt4
                            ws2_32
                            comctl32
                            wsock32
                            opengl32
                            ITKIOGIPL-4.3
                            ITKIONIFTI-4.3
                            ITKIONRRD-4.3
                            ITKIOPNG-4.3
                            itkgdcmDICT-4.3
                            itkgdcmDSED-4.3
                            itkgdcmIOD-4.3
                            itkgdcmjpeg8-4.3
                            itkgdcmjpeg12-4.3
                            itkgdcmjpeg16-4.3
                            itkgdcmMSFF-4.3
                            ITKgiftiio-4.3
                            itkhdf5_cpp-4.3
                            itkhdf5-4.3
                            ITKMetaIO-4.3
                            ITKIOBioRad-4.3
                            ITKIOStimulate-4.3
                            ITKIOTIFF-4.3
                            ITKIOVTK-4.3
                            ITKIOPNG-4.3
                            ITKBiasCorrection-4.3
                            ITKBioCell-4.3
                            ITKFEM-4.3
                            ITKIOBMP-4.3
                            ITKIOCSV-4.3
                            ITKIOGDCM-4.3
                            ITKIOGE-4.3
                            ITKIOGIPL-4.3
                            ITKIOHDF5-4.3
                            ITKIOImageBase-4.3
                            ITKIOIPL-4.3
                            ITKIOJPEG-4.3
                            ITKIOLSM-4.3
                            ITKIOMesh-4.3
                            ITKIOMeta-4.3
                            ITKIOSiemens-4.3
                            ITKIOSpatialObjects-4.3
                            ITKIOTransformBase-4.3
                            ITKIOTransformHDF5-4.3
                            ITKIOTransformInsightLegacy-4.3
                            ITKIOTransformMatlab-4.3
                            ITKIOXML-4.3
                            ITKKLMRegionGrowing-4.3
                            ITKLabelMap-4.3
                            ITKMesh-4.3
                            ITKMetaIO-4.3
                            itkNetlibSlatec-4.3
                            itkopenjpeg-4.3
                            ITKOptimizers-4.3
                            ITKOptimizersv4-4.3
                            ITKPath-4.3
                            itkpng-4.3
                            ITKPolynomials-4.3
                            ITKQuadEdgeMesh-4.3
                            ITKReview-4.3
                            ITKStatistics-4.3
                            itkv3p_lsqr-4.3
                            itkv3p_netlib-4.3
                            itkvcl-4.3
                            ITKVideoCore-4.3
                            ITKVideoIO-4.3
                            ITKVTK-4.3
                            ITKVNLInstantiation-4.3
                            ITKWatersheds-4.3
                        )
535
536
537
                    else()
                        message(FATAL_ERROR "ITK ( >= 4.3.2) is required by ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}")
                    endif()
538
539
540
541
542
543
544
545
546
                else() # Linux / MacOS compilers
                    find_package(ITK REQUIRED)
                    if(ITK_FOUND)
                        message(STATUS "${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} : Found suitable version of ITK : ${ITK_VERSION} (required is 3.20.1)")
                        include(${ITK_USE_FILE})
                        set(ITK_LIBRARIES ITKBasicFilters ITKCommon ITKIO)
                    else()
                        message(FATAL_ERROR "ITK ( >= 3.20.1) is required by ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}")
                    endif()
547
                endif()
548
549
            endif()
        endif()
promayon's avatar
promayon committed
550

551
        # LIBXML2
552
        set(LIBXML2_LIBRARY "")
553
        if(${EXTENSION_NAME_CMAKE}_NEEDS_LIBXML2)
554
555
556
557
558
            # LibXml2 is required
            find_package(Xml2)
            if (LIBXML2_FOUND)
                add_definitions(${LIBXML2_DEFINITIONS})
                include_directories(${LIBXML2_INCLUDE_DIR})
559
                set(LIBXML2_LIBRARY ${LIBXML2_LIBRARIES})
560
561
562
563
            else()
                # most probably win32 or crosscompiling
                message(STATUS "${EXTENSION_NAME}: libxml2 required")
            endif()
564
        endif()
promayon's avatar
promayon committed
565

566
        # OPENCV
promayon's avatar
promayon committed
567
        set(OpenCV_LIBRARIES "")
568
569
570
571
572
573
        if(${EXTENSION_NAME_CMAKE}_NEEDS_OPENCV)
            # OpenCV is required
            find_package( OpenCV REQUIRED )
        else ( )
            set(OpenCV_LIBRARIES "")
        endif()
promayon's avatar
promayon committed
574

575
        # IGSTK
promayon's avatar
promayon committed
576
        set(IGSTK_LIBRARIES "")
577
578
579
        if(${EXTENSION_NAME_CMAKE}_NEEDS_IGSTK)
            find_package(IGSTK REQUIRED)
            include(${IGSTK_USE_FILE})
580
        else()
581
            set(IGSTK_LIBRARIES "")
582
        endif()
promayon's avatar
promayon committed
583

584
585
586
        # XERCES-C
        set(XERCESC_LIBRARIES)
        if(${EXTENSION_NAME_CMAKE}_NEEDS_XERCESC)
587
588
589
590
            # XercesC is required
            find_package(XercesC REQUIRED)
            if (XERCESC_FOUND)
                include_directories(${XERCESC_INCLUDE_DIR})
591
                set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
592
593
            else()
                # most probably win32 or crosscompiling
594
                message(FATAL_ERROR "${APPLICATION_NAME}: xerces-c required. Please provide Xerces-C path.")
595
            endif()
596
        endif()
promayon's avatar
promayon committed
597

598
599
        # XSD
        if(${EXTENSION_NAME_CMAKE}_NEEDS_XSD)
600
601
602
603
            # XercesC is required
            find_package(XercesC REQUIRED)
            if (XERCESC_FOUND)
                include_directories(${XERCESC_INCLUDE_DIR})
604
                set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
605
606
607
608
                find_package(XSD REQUIRED)
                include_directories(${XSD_INCLUDE_DIR})
            else()
                # most probably win32 or crosscompiling
609
                message(FATAL_ERROR "${EXTENSION_NAME}: xerces-c required because of XSD cxx, please set XERCESC_INCLUDE_DIR")
610
            endif()
611
        endif()
612
613
614
615
        
        # GDCM 2.2.x
        set(GDCM_LIBRARIES)
        if(${EXTENSION_NAME_CMAKE}_NEEDS_GDCM)
616
617
618
619
620
621
622
623
624
            if(NOT GDCM_FOUND)
                # Look for GDCM library only if not found (for instance, ITK has already search for it)
                # Calling find_package(GDCM ..) more than once creates CMake errors.
                find_package(GDCM 2.0 REQUIRED)
            endif()
            if(GDCM_FOUND)
                include(${GDCM_USE_FILE})
                if (MSVC)
                    set(GDCM_LIBRARIES 
625
626
                        debug ${GDCM_DIR}/../vtkgdcm${CAMITK_DEBUG_POSTFIX} 
                        debug ${GDCM_DIR}/../gdcmDSED${CAMITK_DEBUG_POSTFIX}
627
                        optimized vtkgdcm gdcmDSED
628
629
                        )
                else()
630
                    set(GDCM_LIBRARIES vtkgdcm gdcmDSED)
631
632
633
634
635
636
                endif()
            else()
                message(ERROR "${EXTENSION_NAME}: GDCM 2.x library required. Please install GDCM.")
            endif()
        endif()
    
637
638
639
640
641
642
        # ADDTIONAL QT MODULES
        set(QT_MODULES_LIBRARIES)
        if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_QT_MODULES)
            # Qt additional modules are required for linking
            set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
        endif()
643
644
        
        # CEP LIBRARIES
645
646
        set(CEP_LIBRARIES)
        if(${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
647
648
649
650
651
652
653
654
655
            foreach(CEP_LIBRARY_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
                string(TOUPPER ${CEP_LIBRARY_NEEDED} ${CEP_LIBRARY_NEEDED}_INTERNAL)
                set(LIBRARY_${${CEP_LIBRARY_NEEDED}_INTERNAL} ON CACHE BOOL "Required by action extension ${EXTENSION_NAME}" FORCE )
                if (MSVC)
                        set(CEP_LIBRARIES ${CEP_LIBRARIES}  debug ${CEP_LIBRARY_NEEDED}${CAMITK_DEBUG_POSTFIX}
                                                            optimized ${CEP_LIBRARY_NEEDED}
                        )
                else()
                    if(PACKAGING_NSIS)
656
                        set(CEP_LIBRARIES ${CEP_LIBRARIES} ${CEP_LIBRARY_NEEDED})
657
                    else()
658
                        set(CEP_LIBRARIES ${CEP_LIBRARIES} ${CEP_LIBRARY_NEEDED})
659
660
661
662
663
664
                    endif()
                endif()
                include_directories(${CAMITK_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
                include_directories(${CAMITK_USER_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
                include_directories(${CAMITK_BUILD_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
            endforeach()
665
        endif()
666
667
        
        # EXTERNAL LIBRARIES 
668
669
670
671
672
673
674
675
676
677
678
679
680
        set(EXTERNAL_LIBRARIES)
        if(${EXTENSION_NAME_CMAKE}_EXTERNAL_LIBRARIES)
            foreach(EXTERNAL_LIBRARY ${${EXTENSION_NAME_CMAKE}_EXTERNAL_LIBRARIES})
                if (MSVC)
                    set(EXTERNAL_LIBRARIES ${EXTERNAL_LIBRARIES} 
                                           debug ${EXTERNAL_LIBRARY}${CAMITK_DEBUG_POSTFIX}
                                           optimized ${EXTERNAL_LIBRARY}
                    )
                else()
                    set(EXTERNAL_LIBRARIES ${EXTERNAL_LIBRARIES} ${EXTERNAL_LIBRARY})
                endif()
            endforeach()
        endif()
saubatn's avatar
saubatn committed
681
        
682
683
        # BACKWARD COMPATIBILITY
        # NEEDS_TOOLS option
684
685
686
687
688
        # TODO CAMITK_OBSOLETE. This option is marked as obsolete. It is to be removed in CamiTK 4.0
        if(${EXTENSION_NAME_CMAKE}_NEEDS_TOOL)
            message(WARNING "Warning: ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt: camitk_extension macro option NEEDS_TOOL is deprecated, please use NEEDS_CEP_LIBRARIES instead..")
            set(${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES ${${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES} ${${EXTENSION_NAME_CMAKE}_NEEDS_TOOL})
        endif()
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
        
        
        
        #########################################################################
        #                                                                       #
        #   CAMITK ACTION / COMPONENT DEPENDENCIES                              #
        #                                                                       #
        #   * Look for action / component dependencies                          #
        #   * Specific actions / components are specified as option with the    #
        #     NEEDS_ACTION/COMPONENT_EXTENSION syntax                           #
        #                                                                       #
        #########################################################################
        
        # COMPONENT EXTENSION DEPENDENCIES
        set(COMPONENT_EXTENSION_LIBRARIES)
704
705
706
707
        if(${EXTENSION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION)
          foreach(COMPONENT_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION})
            string(TOUPPER ${COMPONENT_NEEDED} ${COMPONENT_NEEDED}_INTERNAL)
            set(COMPONENT_${${COMPONENT_NEEDED}_INTERNAL} ON CACHE BOOL "Required by extension ${EXTENSION_NAME}" FORCE )
saubatn's avatar
saubatn committed
708
            if (MSVC)
709
710
711
                set(COMPONENT_EXTENSION_LIBRARIES ${COMPONENT_EXTENSION_LIBRARIES}
                                                  debug ${CAMITK_BUILD_PRIVATE_LIB_DIR}/components/${COMPONENT_NEEDED}${CAMITK_DEBUG_POSTFIX}
                                                  optimized ${COMPONENT_NEEDED}
saubatn's avatar
saubatn committed
712
713
                )
            else()
714
                set(COMPONENT_EXTENSION_LIBRARIES ${COMPONENT_EXTENSION_LIBRARIES} ${COMPONENT_NEEDED})
saubatn's avatar
saubatn committed
715
            endif()
716
717
718
719
720
            include_directories(${CAMITK_INCLUDE_DIR}/components/${COMPONENT_NEEDED})
            include_directories(${CAMITK_USER_INCLUDE_DIR}/components/${COMPONENT_NEEDED})
            include_directories(${CAMITK_BUILD_INCLUDE_DIR}/components/${COMPONENT_NEEDED})
          endforeach()
        endif()
721
722
        
        # ACTION EXTENSION DEPENDENCIES
723
724
        set(ACTION_EXTENSION_LIBRARIES)
        if(${EXTENSION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION)
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
            foreach(ACTION_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION})
                string(TOUPPER ${ACTION_NEEDED} ${ACTION_NEEDED}_INTERNAL)
                set(ACTION_${${ACTION_NEEDED}_INTERNAL} ON CACHE BOOL "Required by extension ${EXTENSION_NAME}" FORCE )
                if (MSVC)
                    set(ACTION_EXTENSION_LIBRARIES ${ACTION_EXTENSION_LIBRARIES}
                                                   debug ${CAMITK_BUILD_PRIVATE_LIB_DIR}/actions/${ACTION_NEEDED}${CAMITK_DEBUG_POSTFIX}
                                                   optimized ${ACTION_NEEDED}
                    )
                else()
                    set(ACTION_EXTENSION_LIBRARIES ${ACTION_EXTENSION_LIBRARIES} ${ACTION_NEEDED})
                endif()
                include_directories(${CAMITK_INCLUDE_DIR}/actions/${ACTION_NEEDED})
                include_directories(${CAMITK_USER_INCLUDE_DIR}/actions/${ACTION_NEEDED})
                include_directories(${CAMITK_BUILD_INCLUDE_DIR}/actions/${ACTION_NEEDED})        
            endforeach()
740
        endif()
741
742
743
744
745
746
747
748
749
750
751
752
753
            
        
        
        #########################################################################
        #                                                                       #
        #   LINK DIRECTORIES                                                    #
        #                                                                       #
        #   * Link directories are used to indicate the compiler where          #
        #     to look for folder containing libraries to link with.             #
        #                                                                       #
        #########################################################################
        
        # CAMITK BASIC LIB DIRECTORIES
754
        link_directories(${CAMITK_LINK_DIRECTORIES})
promayon's avatar
promayon committed
755

756
        
757
758
759
760
761
762
763
764
765
        
        #########################################################################
        #                                                                       #
        #   TARGET COMPILATION DEFINITION                                       #
        #                                                                       #
        #   * Additional sources files to consider at compilation (.cpp)        #
        #   * CMake project target definition                                   #
        #                                                                       #
        #########################################################################
saubatn's avatar
saubatn committed
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
        # EXTERNAL SOURCES
        set(${EXTENSION_NAME_CMAKE}_SOURCES ${${EXTENSION_NAME_CMAKE}_SOURCES} ${${EXTENSION_NAME_CMAKE}_EXTERNAL_SOURCES})

        # CMAKE TARGET DEFINITION
        add_library(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} SHARED ${${EXTENSION_NAME_CMAKE}_SOURCES})
        
        
        
        #########################################################################
        #                                                                       #
        #   COMPILATION FLAG                                                    #
        #                                                                       #
        #   * Flags are options to give to the compiler                         #
        #   * Add user input flags                                              #
        #   * Add platform specific flags                                       #
        #                                                                       #
        #########################################################################
783
784
785
786
787
788
789

        # USER INPUT COMPILER FLAG
        if(${EXTENSION_NAME_CMAKE}_DEFINES)
          foreach (FLAG ${${EXTENSION_NAME_CMAKE}_DEFINES})
            add_definitions(-D${FLAG})
          endforeach()
        endif()
790

saubatn's avatar
saubatn committed
791
792
        # PLATFORM SPECIFIC COMPILER FLAG
        # 64bits and other platform with relocation needs -fPIC
793
794
795
796
797
798
799
800
        include(TestCXXAcceptsFlag)
        check_cxx_accepts_flag(-fPIC FPIC_FLAG_ACCEPTED)
        # no need to add -fPIC on mingw, otherwise it generates a warning: -fPIC ignored for target (all code is position independent) [enabled by default]
        # msvc is also accepting the flag, but then produce warning D9002 : ignoring unknown option '-fPIC'   cl
        if(FPIC_FLAG_ACCEPTED AND NOT WIN32)
            set_property(TARGET ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} APPEND PROPERTY COMPILE_FLAGS -fPIC)
        endif()
        
promayon's avatar
promayon committed
801

saubatn's avatar
saubatn committed
802
        
803
804
805
806
807
808
809
810
811
        #########################################################################
        #                                                                       #
        #   LINKING                                                             #
        #                                                                       #
        #   * Linking is the last stage of compilation                          #
        #   * Indicate what libraries to use for linking the target             #
        #                                                                       #
        #########################################################################
        # LINKING LIBRARIES
812
        # Any component or action has to be linked with ${CAMITK_CORE_LIBRARIES} and with all its dependencies
813
814
815
        target_link_libraries(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} ${CAMITK_CORE_LIBRARIES} ${CAMITK_LIBRARIES} ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CEP_LIBRARIES} ${QT_MODULES_LIBRARIES} ${ITK_LIBRARIES} ${LIBXML2_LIBRARY} ${OpenCV_LIBRARIES} ${IGSTK_LIBRARIES} ${XERCESC_LIBRARIES} ${GDCM_LIBRARIES} ${EXTERNAL_LIBRARIES})


816
817
818
819
820
821
822
823
824
825
826
        
        #########################################################################
        #                                                                       #
        #   OUTPUT                                                              #
        #                                                                       #
        #   * Define the output directory (location and name)                   #
        #   * Define the output name of the library                             #
        #   * Add ${CAMITK_DEBUG_POSTFIX} suffix to Debug MSVC built libraries  #
        #   * Additional Linux .so files information                            #
        #                                                                       #
        #########################################################################
827
828
829
830
831
        
        # OUTPUT LIBRARY NAME
        set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                               PROPERTIES OUTPUT_NAME ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}
        )
promayon's avatar
promayon committed
832

833
        # OUTPUT DIRECTORY LOCATION AND NAME
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
        # Output directory (all extensions are private)
        set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
                                                                                LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
                                                                                LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s        
        )
        # Output directory (for dll plateform, this is still the same, extensions are private)
        set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
                                                                                RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
                                                                                RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
        )
        # Output directory (for dll plateform, this is still the same, extensions are private)
        set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
                                                                                ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
                                                                                ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s
        )
849
850
        
        # OUTPUT LIBRARY NAME MSVC in DEBUG mode
851
852
853
        if (MSVC)
            set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX})
        endif()
854
855
        
        # ADDITIONAL LINUX .so FILE INFORMATION
856
857
858
859
860
861
        set(${TYPE_EXTENSION_CMAKE}_LIBRARY_PROPERTIES ${${TYPE_EXTENSION_CMAKE}_LIBRARY_PROPERTIES}
            VERSION   "${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR}.${CAMITK_VERSION_PATCH}"
            SOVERSION "${CAMITK_VERSION_MAJOR}"
        )
        # set the library specific info (SONAME...)
        set_target_properties(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTIES ${${TYPE_EXTENSION_CMAKE}_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "")
862
    
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
        # see http://www.cmake.org/pipermail/cmake/2012-April/049889.html
        # target properties (outputname and remove soname)
        #  set_property(TARGET ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} PROPERTY NO_SONAME 1)
        # in CEP the version patch might not have been set
        if (NOT CAMITK_VERSION_PATCH)
            set(CAMITK_VERSION_PATCH 0)
        endif()
        
       
        
        #########################################################################
        #                                                                       #
        #   INSTALLATION                                                        #
        #                                                                       #
        #   * When installing the project, header files (.h) and test data are  #
        #     copied into a installation folder to determine.                   #
        #   * Indicate in this section, where to install your project and which #
        #     files to copy into that folder (during local/global installation) #
        #                                                                       #
        #########################################################################

        # FOLDER INSTALLATION
        # Indicate where to install the action/component
        install(TARGETS ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                # TODO always use private lib, even for runtime
                RUNTIME DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}/${TYPE_EXTENSION}s
                LIBRARY DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}/${TYPE_EXTENSION}s
                ARCHIVE DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}/${TYPE_EXTENSION}s
                COMPONENT ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
        )
promayon's avatar
promayon committed
893

894
895
896
897
898
        # HEADERS INSTALLATION
        # Build target to install provided headers to install (with HEADERS_TO_INSTALL option)
        if(${EXTENSION_NAME_CMAKE}_HEADERS_TO_INSTALL)
            export_headers(${${EXTENSION_NAME_CMAKE}_HEADERS_TO_INSTALL} COMPONENT ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} GROUP ${TYPE_EXTENSION}s)
        endif()
899

900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
        # Build target to install all header files(with HEADERS_ALL_HEADERS option)
        if(${EXTENSION_NAME_CMAKE}_INSTALL_ALL_HEADERS)
            export_headers(${${EXTENSION_NAME_CMAKE}_HEADERS} COMPONENT ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} GROUP ${TYPE_EXTENSION}s)
        endif()
        
        # TESTDATA INSTALLATION
        if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/testdata)
            # Check test data dir directory
            if (NOT EXISTS ${CAMITK_BUILD_TESTDATA_DIR})
                add_custom_command(TARGET ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                  POST_BUILD
                                  COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_BUILD_TESTDATA_DIR}
                                  COMMENT "Creating build-time share directory for test data ${CAMITK_BUILD_TESTDATA_DIR}"
                                  VERBATIM
                )
            endif()
916

917
918
919
920
921
922
923
924
            # At build time, copy the files to test data directory
            add_custom_command(TARGET ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                            POST_BUILD
                            COMMAND ${CMAKE_COMMAND} -E copy_directory testdata ${CAMITK_BUILD_TESTDATA_DIR}
                            COMMENT "Installing build-time test data for ${EXTENSION_NAME}"
                            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                            VERBATIM
            )
promayon's avatar
promayon committed
925

926
927
928
929
930
931
932
933
934
935
            # during installation, copy the files to install directory
            set (TESTDATA_DEST_DIR share/${CAMITK_SHORT_VERSION_STRING}/testdata)
            install(DIRECTORY testdata/
                  #DESTINATION share/testdata
                  #DESTINATION share/${CAMITK_SHORT_VERSION_STRING}/testdata
                  DESTINATION ${TESTDATA_DEST_DIR}
                  # COMPONENT ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                  PATTERN ".svn" EXCLUDE
                  PATTERN "*~" EXCLUDE
            )
promayon's avatar
promayon committed
936
        endif()
937
938
        
        # CTESTDATA INSTALLATION
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
        if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/testdata/ctestdata)
            # Check test data dir directory
            if (NOT EXISTS ${CAMITK_BUILD_CTESTDATA_DIR})
                add_custom_command(TARGET ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                  POST_BUILD
                                  COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_BUILD_CTESTDATA_DIR}
                                  COMMENT "Creating build-time share directory for test data ${CAMITK_BUILD_CTESTDATA_DIR}"
                                  VERBATIM
                )
            endif()

            # At build time, copy the files to test data directory
            add_custom_command(TARGET ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                            POST_BUILD
                            COMMAND ${CMAKE_COMMAND} -E copy_directory testdata/ctestdata ${CAMITK_BUILD_CTESTDATA_DIR}
                            COMMENT "Installing build-time test data for ${EXTENSION_NAME}"
                            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                            VERBATIM
            )

            # during installation, copy the files to install directory
            set (CTESTDATA_DEST_DIR share/${CAMITK_SHORT_VERSION_STRING}/testdata/ctestdata)
            install(DIRECTORY testdata/ctestdata
                  DESTINATION ${CTESTDATA_DEST_DIR}
                  PATTERN ".svn" EXCLUDE
                  PATTERN "*~" EXCLUDE
            )
        endif()
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
        
        #########################################################################
        #                                                                       #
        #   PROJECT DEPENDENCIES                                                #
        #                                                                       #
        #   * Add in this section library dependencies to other camitk projects #
        #     to keep a correct build order.                                    #
        #                                                                       #
        #########################################################################
        
        # CAMITKCORE LIBRARY DEPENDENCY
        add_dependencies(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} ${CAMITK_CORE_TARGET_LIB_NAME})

        # COMPONENTS DEPENDENCIES
        if(${EXTENSION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION)
982
983
984
985
986
987
988
989
            foreach(COMPONENT_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION})
                string(TOUPPER ${COMPONENT_NEEDED} COMPONENT_NEEDED_CMAKE)
                # if this is not true, then the dependencies is from an external build, do not use add_dependencies
                if (${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_INTERNAL)
                    # TODO add IMPORTED
                    add_dependencies(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} component-${COMPONENT_NEEDED})
                endif()
            endforeach()
promayon's avatar
promayon committed
990
        endif()
991
992
993
        
        # ACTIONS DEPENDENCIES
        if(${EXTENSION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION)
994
995
996
997
998
999
1000
1001
            foreach(ACTION_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION})
                string(TOUPPER ${ACTION_NEEDED} ACTION_NEEDED_CMAKE)
                # if this is not true, then the dependencies is from an external build, do not use add_dependencies
                if (${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE}_INTERNAL)
                    # TODO add IMPORTED
                    add_dependencies(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} action-${ACTION_NEEDED})
                endif()
            endforeach()
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
        endif()
        
        # CEP LIBRARIES DEPENDENCIES
        if(${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
            foreach(CEP_LIBRARY_NEEDED ${${EXTENSION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
                # TODO add IMPORTED
                if (PACKAGING_NSIS)
                    add_dependencies(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} library_${CEP_LIBRARY_NEEDED})
                else()
                    add_dependencies(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} library-${CEP_LIBRARY_NEEDED})
                endif()
            endforeach()
        endif()
1015
1016
1017
1018
        
        
        
        #########################################################################
1019
1020
1021
        #                                                                       #
        #   CDASH SUBPROJECT DESCRIPTION                                        #
        #                                                                       #
1022
1023
        #   * Update the XML description of the subprojects dependencies        #
        #     for CDash.                                                        #
1024
        #                                                                       #
1025
        #########################################################################       
1026
1027
        # CDASH XML SUBPROJECTS DESCRIPTION UPDATE
        camitk_sub_project_add(${TYPE_EXTENSION_CMAKE} ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} DEPENDENCIES ${CAMITK_CORE_LIBRARIES} ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CEP_LIBRARIES})
1028
1029
        
        
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
        
        #########################################################################
        #                                                                       #
        #   PACKAGING CATEGORIZATION                                            #
        #                                                                       #
        #   * On Windows, when building a package (win32 installer), the        #
        #     install shield wizard proposes you to select which component      #
        #     to install.                                                       #
        #   * Each component to install has a short description following its   #
        #     name to understand its role.                                      #
        #   * This section deals with the categorization and the description    #
        #     of the component in this installer.                               #
        #                                                                       #
        #########################################################################
        
        # WINDOWS INSTALLER CATEGORIZATION
        if(${EXTENSION_NAME_CMAKE}_CEP_NAME)
            if (${EXTENSION_NAME_CMAKE}_CEP_NAME MATCHES "SDK")
                # The default SDK extensions are categorized as "required" and are not "unselectable" by the user at installation time
                cpack_add_component(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                    DISPLAY_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                    DESCRIPTION ${${EXTENSION_NAME_CMAKE}_DESCRIPTION}
                                    REQUIRED
                                    GROUP SDK
                                    )
            
1056
            else()
1057
1058
1059
1060
1061
1062
                # Extension is selectable for installation in the wizard of the installer
                cpack_add_component(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                    DISPLAY_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                    DESCRIPTION ${${EXTENSION_NAME_CMAKE}_DESCRIPTION}
                                    GROUP ${${EXTENSION_NAME_CMAKE}_CEP_NAME}
                                    )
1063
            endif()
1064
        else()
1065
            # Extension if not categorized for packaging presentation
1066
1067
1068
1069
1070
            cpack_add_component(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                DISPLAY_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
                                DESCRIPTION ${${EXTENSION_NAME_CMAKE}_DESCRIPTION}
                                )
        endif()
1071

1072
1073
        #########################################################################
        #                                                                       #
1074
        #   CTEST - COMPONENT TESTS DESCRIPTION                                 #
1075
1076
        #                                                                       #
        #########################################################################
1077
        if( ${EXTENSION_NAME_CMAKE}_COMPONENT_EXTENSION AND ${EXTENSION_NAME_CMAKE}_TEST_APPLICATION )
1078
            message( "GENERATE CTEST TESTS - TARGETNAME IS " ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} " TEST APPLICATION IS " ${${EXTENSION_NAME_CMAKE}_TEST_APPLICATION} )
1079
            camitk_init_test( ${${EXTENSION_NAME_CMAKE}_TEST_APPLICATION} )
1080
1081

            # Retrieve the current directory name to properly name the test
1082
1083
            get_directory_name( ${CMAKE_CURRENT_SOURCE_DIR} COMP_DIR_NAME )

1084
            # Test should pass because application test runs with no arguments - shows usage and exit success
1085
            camitk_add_test( TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
1086
1087
1088
1089
            # Retrieve the files in testdata directory - a test will be applied for each of these files
            get_subdirectoryfiles( ${CMAKE_CURRENT_SOURCE_DIR}/testdata/ctestdata TESTFILES )

            foreach( COMPONENT_TESTDATA_FILE ${TESTFILES} )        
1090
1091
                # Give the file name (full path cut) 
                get_directory_name( ${COMPONENT_TESTDATA_FILE} DATA_FILE )  
1092

1093
1094
                # Test procedure: Open a file - save it - Compare saved file to original file 
                camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}" PASS_FILE_OUTPUT ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
1095
1096
1097
1098
            endforeach()

            # Test should pass because invoking application-test with a faulty arguments results in printing
            # an "Usage error" message (and exit failure)
1099
            camitk_add_test( EXECUTABLE_ARGS "-error" PASS_REGULAR_EXPRESSION "Usage" TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
promayon's avatar
promayon committed
1100

1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
        #########################################################################
        #                                                                       #
        #   CTEST - ACTION TESTS DESCRIPTION                                    #
        #                                                                       #
        #########################################################################
        elseif( ${EXTENSION_NAME_CMAKE}_ACTION_EXTENSION AND ${EXTENSION_NAME_CMAKE}_TEST_APPLICATION )
            message( "GENERATE CTEST TESTS - TARGETNAME IS " ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} " TEST APPLICATION IS " ${${EXTENSION_NAME_CMAKE}_TEST_APPLICATION} )
            camitk_init_test( ${${EXTENSION_NAME_CMAKE}_TEST_APPLICATION} )

            # Retrieve the current directory name to properly name the test
            get_directory_name( ${CMAKE_CURRENT_SOURCE_DIR} COMP_DIR_NAME )

            # Test should pass because application test runs with no arguments - shows usage and exit success
            camitk_add_test( PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
            
            # Test should pass because invoking application-test with a faulty arguments results in printing
            # an "Usage error" message (and exit failure)
            camitk_add_test( EXECUTABLE_ARGS "-error" PASS_REGULAR_EXPRESSION "Usage" PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
            
            # Retrieve the files in ctestdata directory - tests will be applied for each of these files
            get_subdirectoryfiles( ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata TESTFILES )

            #get the names of actions .dlls in lib directory
            get_subdirectoryfiles( ${CAMITK_BUILD_PRIVATE_LIB_DIR}/actions/ ACTIONSDLLS )
            
            foreach( ACTION_TESTDATA_FILE ${TESTFILES} )
                    # Give the file name (full path cut)
                    get_directory_name( ${ACTION_TESTDATA_FILE} DATA_FILE )
                        if( NOT ( ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME} MATCHES "application" ) )#We do not apply tests on actions like (close, save, save as) 
                            # Test procedure: Open a file - load an action extension - Apply an action on the component wrapping the file
                            if(MSVC)
                                camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -a ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll" PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
                            else()
                                camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -a ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dll" PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
                            endif()
                        endif()
            endforeach()
        endif()
1139
1140
    endif() # endif(${TYPE_EXTENSION_CMAKE}_${EXTENSION_NAME_CMAKE})
    
promayon's avatar
promayon committed
1141
1142
1143
1144
endmacro()

# Old macro to configure a new action to the framework
# Use camitk_extension macro instead
1145
# TODO CAMITK_OBSOLETE. This macro is marked as obsolete. It is to be removed in CamiTK 4.0
promayon's avatar
promayon committed
1146
macro(action_extension)
1147
1148
    message(WARNING "Deprecated macro action_extension detected : please use camitk_extension(ACTION_EXTENSION ...) instead.")
    camitk_extension(ACTION_EXTENSION ${ARGN})
promayon's avatar
promayon committed
1149
1150
1151
1152
endmacro()

# Old macro to configure a new component to the framework
# Use camitk_extension macro instead
1153
# TODO CAMITK_OBSOLETE. This macro is marked as obsolete. It is to be removed in CamiTK 4.0
promayon's avatar
promayon committed
1154
macro(component_extension)
1155
1156
    message(WARNING "Deprecated macro component_extension detected : please use camitk_extension(COMPONENT_EXTENSION ...) instead.")
    camitk_extension(COMPONENT_EXTENSION ${ARGN})
promayon's avatar
promayon committed
1157
1158
1159
endmacro()

# TODO write a viewer_extension macro in CamiTK