This file is indexed.

/usr/share/camitk-3.3/cmake/macros/CamiTKApplication.cmake is in libcamitk3-dev 3.3.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
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
338
339
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
431
432
433
434
435
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
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
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
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
#!
#! @ingroup group_sdk_cmake
#!
#! macro camitk_application simplify writing a CMakeLists.txt for CamiTK application extension
#!
#! The name of the application is automatically the name of the directory from where this macro
#! is called prefixed with "camitk-"
#!
#! On Unix additional system resources can also be automatically installed or configured: man pages,
#! desktop file and XPM icons.
#! - Man pages should be resources/camitk-appdirname.1 or resources/camitk-appdirname.1.in (in this
#! case, it will be configured first).
#! - Desktop file should be in resources/camitk-appdirname.desktop (refer to
#!    http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html and
#!    http://standards.freedesktop.org/menu-spec/1.0/apa.html for valid category details)
#! - XPM icons should be found in resources/camitk-appdirname.xpm (an icon can also be used in
#!   to set the application icon (use setWindowIcon(QIcon(":/resources/camitk-appdirname.xpm")) as well)
#!
#! To write a simple man page, please refer to SDK application examples. If you need to
#! generate a simple manpage or analyze the command line arguments, the CamiTK team recommands
#! to use Code Synthesis CLI configuration (see http://codesynthesis.com/projects/cli)
#! 
#! usage:
#! \code
#! camitk_application(
#!              [DISABLED]
#!              [NEEDS_QT_MODULES]
#!              [NEEDS_ITK]
#!              [NEEDS_PYTHON]
#!              [NEEDS_CEP_LIBRARIES CEPLib1 CEPLib12 ...]
#!              [NEEDS_COMPONENT_EXTENSION component1 component2 ...]
#!              [NEEDS_ACTION_EXTENSION ation1 action2 ...]
#!              [DEFINES flag1 flag2 ...]
#!              [CXX_FLAGS flag1 flag2 ...]
#!              [ADDITIONAL_SOURCES source.cxx source.cpp ...]
#!              [INCLUDE_DIRECTORIES dir1 dir2 ...]
#!              [EXTERNAL_LIBRARIES lib1 lib2 ...]
#!     )
#! \endcode
#!
#! \param DISABLED                      means this is a default application is NOT to be compiled automatically
#! \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
#! \param NEEDS_ITK                     means this application requires ITK to be compiled / run.
#! \param NEEDS_CEP_LIBRARIES           list of needed camitk CEP libraries
#! \param NEEDS_COMPONENT_EXTENSION     list of needed component extensions
#! \param NEEDS_ACTION_EXTENSION        list of needed component extensions
#! \param DEFINES                       list of define flags to add at compilation time
#! \param CXX_FLAGS                 = list of compiler flags to add (such as warning levels (-Wall ...)).
#! \param ADDITIONAL_SOURCES            list of additional sources (that cannot be automatically found by gather_headers_and_sources macro)
#! \param CEP_NAME                      specify the CEP_NAME, which is used to categorized the application for packaging purpose
#!                                      No CEP_NAME provided will result in default categorization (generic application).
#! \param DESCRIPTION                   Simple description of the application. Used for packaging presentation for instance.
#! \param INCLUDE_DIRECTORIES           additional include directories
#! \param EXTERNAL_LIBRARIES            external libraries to add to the link command
macro(camitk_application)

    #########################################################################
    #                                                                       #
    #   ARGUMENTS PARSING                                                   #
    #                                                                       #
    #   * Use a macro to create the CMAKE variables according to the        #
    #     provided options as input.                                        #
    #                                                                       #
    #########################################################################

    get_directory_name(${CMAKE_CURRENT_SOURCE_DIR} APPLICATION_NAME)

    parse_arguments(${APPLICATION_NAME_CMAKE}
        "NEEDS_CEP_LIBRARIES;NEEDS_TOOL;NEEDS_COMPONENT_EXTENSION;NEEDS_ACTION_EXTENSION;DEFINES;CXX_FLAGS;ADDITIONAL_SOURCES;CEP_NAME;DESCRIPTION;EXTERNAL_LIBRARIES;INCLUDE_DIRECTORIES"  # possible lists
        "DISABLED;NEEDS_QT_MODULES;NEEDS_ITK;NEEDS_QTXML;NEEDS_XSD;NEEDS_XERCESC;NEEDS_PYTHON" # possible options
        ${ARGN}
    )
    
    
    
    #########################################################################
    #                                                                       #
    #   CREATE CMAKE VARIABLES                                              #
    #                                                                       #
    #   * Create required and usefull CMake variables for the macro         #
    #                                                                       #
    #########################################################################

    # CMAKE CACHE VARIABLE
    # if it is the first cmake run, create the application variable with a correct initial value    
    if(NOT APPLICATION_${APPLICATION_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}_${APPLICATION_NAME_CMAKE}_DISABLED:BOOL=TRUE
        if(${APPLICATION_NAME_CMAKE}_DISABLED)
            set(APPLICATION_${APPLICATION_NAME_CMAKE}_ENABLED FALSE)
        else()
            set(APPLICATION_${APPLICATION_NAME_CMAKE}_ENABLED TRUE)
        endif()
        set(APPLICATION_${APPLICATION_NAME_CMAKE} ${APPLICATION_${APPLICATION_NAME_CMAKE}_ENABLED} CACHE BOOL "Build application ${APPLICATION_NAME}")
        set(APPLICATION_${APPLICATION_NAME_CMAKE}_INTERNAL TRUE CACHE INTERNAL "Is variable APPLICATION_${APPLICATION_NAME} already created?")
    endif()
    
    # APPLICATION TARGET NAME
    if (PACKAGING_NSIS)
        # NSIS requires that cpack component names do not feature space or "-" characters
        set(APPLICATION_TARGET_NAME application_${APPLICATION_NAME})
    else()
        set(APPLICATION_TARGET_NAME application-${APPLICATION_NAME})
    endif()
        
  
  
    # if this extension is enabled, do everything needed
    # otherwise... do nothing
    if (APPLICATION_${APPLICATION_NAME_CMAKE})
    
        message(STATUS "Building application ${APPLICATION_NAME}")
        
        
        
        #########################################################################
        #                                                                       #
        #   INCLUDE DIRECTORIES                                                 #
        #                                                                       #
        #   * Include basic directories where to look header files              #
        #   * Include also additional user provided directories                 #
        #   * These directories are used for compilation step                   #
        #                                                                       #
        #########################################################################
        # BASIC DIRECTORIES
        include_directories(${CAMITK_INCLUDE_DIRECTORIES}) 
        include_directories(${CMAKE_CURRENT_BINARY_DIR})
        include_directories(${CMAKE_CURRENT_SOURCE_DIR})
        
        # USER INPUT DIRECTORIES
        include_directories(${${APPLICATION_NAME_CMAKE}_INCLUDE_DIRECTORIES})
        
        
    
        #########################################################################
        #                                                                       #
        #   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
        # 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(${APPLICATION_NAME})
                
        
        
        #########################################################################
        #                                                                       #
        #   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 #
        #                                                                       #
        #########################################################################
        
        # Looking for ITK
        set(ITK_LIBRARIES "")
        if(${APPLICATION_NAME_CMAKE}_NEEDS_ITK) # ITK is required
            if (MSVC) # Visual Studio compiler
                if(MSVC90 OR MSVC10)
                    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
                            debug ITKAlgorithms${CAMITK_DEBUG_POSTFIX}
                            optimized ITKAlgorithms
                            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 OR MSVC12) # Visual Studion 2012 /2013 => 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 ITKAlgorithms-4.3${CAMITK_DEBUG_POSTFIX}.lib
                            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
                            # Release librariesdebug
                            optimized ITKAlgorithms-4.3.lib
                            optimized ITKCommon-4.3.lib
                            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()
                         message(FATAL_ERROR "ITK ( >= 4.3.2) is required by ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}")
                    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()
            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
                            ITKAlgorithms-4.3
                            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
                        )
                    else()
                        message(FATAL_ERROR "ITK ( >= 4.3.2) is required by ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}")
                    endif()
                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()
                endif()
            endif()
        endif()

        # XERCES-C
        set(XERCESC_LIBRARIES)
        if(${APPLICATION_NAME_CMAKE}_NEEDS_XERCESC)
          # XercesC is required
          find_package(XercesC REQUIRED)
          if (XERCESC_FOUND)
            include_directories(${XERCESC_INCLUDE_DIR})
            set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
          else()
            # most probably win32 or crosscompiling
            message(FATAL_ERROR "${APPLICATION_NAME}: xerces-c required. Please provide Xerces-C path.")
          endif()
        endif()

        # XSD
        if(${APPLICATION_NAME_CMAKE}_NEEDS_XSD)
            # XercesC is required
            find_package(XercesC REQUIRED)
            if (XERCESC_FOUND)
                include_directories(${XERCESC_INCLUDE_DIR})
                set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
                find_package(XSD REQUIRED)
                include_directories(${XSD_INCLUDE_DIR})
            else()
                # most probably win32 or crosscompiling
                message(FATAL_ERROR "${APPLICATION_NAME}: xerces-c required because of XSD cxx, please set XERCESC_INCLUDE_DIR")
            endif()
        endif()

        # PYTHON
        set(PYTHON_LIBRARIES "")
        if(${APPLICATION_NAME_CMAKE}_NEEDS_PYTHON)
            message(STATUS "Python needed by ${APPLICATION_NAME}")
            find_package(PythonLibs 2.7 REQUIRED)
            if(PYTHONLIBS_FOUND)
                message(STATUS "Python found (needed by ${APPLICATION_NAME})")
                include_directories(${PYTHON_INCLUDE_DIRS})
                # PYTHON_LIRARIES is automatically and correctly set by find_package
            else()
                message(FATAL_ERROR "Python (2.7 or above) is required by ${APPLICATION_NAME} : please add your python installation dir to your PATH environment variable")
            endif()
        endif()
        
        # QT MODULES
        set(QT_MODULES_LIBRARIES)
        if(${APPLICATION_NAME_CMAKE}_NEEDS_QT_MODULES)
            find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork REQUIRED)
            if(NOT QT4_FOUND)
                message(SEND_ERROR "${APPLICATION_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
            endif()
        
            # CMake will add the Qt modules specific include directories
            include(${QT_USE_FILE})
            # Qt additional modules are required for linking
            set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
        endif()
       
        # CEP LIBRARIES
        if(${APPLICATION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
            foreach(CEP_LIBRARY_NEEDED ${${APPLICATION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
                message(STATUS "${CEP_LIBRARY_NEEDED} required by application ${APPLICATION_NAME}")
                string(TOUPPER ${CEP_LIBRARY_NEEDED} ${CEP_LIBRARY_NEEDED}_INTERNAL)
                set(LIBRARY_${${CEP_LIBRARY_NEEDED}_INTERNAL} ON CACHE BOOL "Required by application ${APPLICATION_NAME}" FORCE )

                # Add the libraries to link against according to the dependencies
                if (MSVC)
                        set(CEP_LIBRARIES ${CEP_LIBRARIES}  debug ${CEP_LIBRARY_NEEDED}${CAMITK_DEBUG_POSTFIX}
                                                            optimized ${CEP_LIBRARY_NEEDED}
                        )
                else()
                    if(PACKAGING_NSIS)
                        set(CEP_LIBRARIES ${CEP_LIBRARIES} library_${CEP_LIBRARY_NEEDED})
                    else()
                        set(CEP_LIBRARIES ${CEP_LIBRARIES} library-${CEP_LIBRARY_NEEDED})
                    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})
	            include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/${CEP_LIBRARY_NEEDED})
            endforeach()
        endif()
        
        # EXTERNAL LIBRARIES
        set(EXTERNAL_LIBRARIES)
        if(${APPLICATION_NAME_CMAKE}_EXTERNAL_LIBRARIES)
            foreach(EXTERNAL_LIBRARY ${${APPLICATION_NAME_CMAKE}_EXTERNAL_LIBRARIES})
                if (MSVC) # TODO We have to decide how to handle debug version of external libraries
                    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()
        
        # BACKWARD COMPATIBILITY
        # NEEDS_TOOLS option
        # TODO CAMITK_DEPRECATED. This option is marked as deprecated. It is to be removed in CamiTK 4.0
        # check deprecated (and warn)
        # TODO CAMITK_DEPRECATED. This option is marked as deprecated. It is to be removed in CamiTK 4.0
        if(${APPLICATION_NAME_CMAKE}_NEEDS_TOOL)
            message(WARNING "Warning: ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt: camitk_application macro option NEEDS_TOOL is deprecated, please use NEEDS_CEP_LIBRARIES instead..")
            set(CEP_LIBRARIES ${CEP_LIBRARIES} ${${APPLICATION_NAME_CMAKE}_NEEDS_TOOL})
        endif()
        
        
        
        #########################################################################
        #                                                                       #
        #   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)
        if(${APPLICATION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION)
            foreach(COMPONENT_NEEDED ${${APPLICATION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION})
                string(TOUPPER ${COMPONENT_NEEDED} ${COMPONENT_NEEDED}_INTERNAL)
                set(COMPONENT_${${COMPONENT_NEEDED}_INTERNAL} ON CACHE BOOL "Required by application ${APPLICATION_NAME}" FORCE )
                if (MSVC)
                    set(COMPONENT_EXTENSION_LIBRARIES ${COMPONENT_EXTENSION_LIBRARIES}
                                                    debug ${CAMITK_BUILD_PRIVATE_LIB_DIR}/components/${COMPONENT_NEEDED}${CAMITK_DEBUG_POSTFIX}
                                                    optimized ${COMPONENT_NEEDED}
                    )
                else()
                    set(COMPONENT_EXTENSION_LIBRARIES ${COMPONENT_EXTENSION_LIBRARIES} ${COMPONENT_NEEDED})
                endif()
                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()
        
        # ACTION EXTENSION DEPENDENCIES
        set(ACTION_EXTENSION_LIBRARIES)
        if(${APPLICATION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION)
            foreach(ACTION_NEEDED ${${APPLICATION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION})
                string(TOUPPER ${ACTION_NEEDED} ${ACTION_NEEDED}_INTERNAL)
                set(ACTION_${${ACTION_NEEDED}_INTERNAL} ON CACHE BOOL "Required by extension ${APPLICATION_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()
        endif()
        
        
            
        #########################################################################
        #                                                                       #
        #   LINK DIRECTORIES                                                    #
        #                                                                       #
        #   * Link directories are used to indicate the compiler where          #
        #     to look for folder containing libraries to link with.             #
        #                                                                       #
        #########################################################################
        # CAMITK BASIC LIB DIRECTORIES
        link_directories(${CAMITK_LINK_DIRECTORIES})
        
        

        #########################################################################
        #                                                                       #
        #   TARGET COMPILATION  DEFINITION                                      #
        #                                                                       #
        #   * Additional sources files to consider at compilation (.cpp)        #
        #   * CMake project target definition                                   #
        #                                                                       #
        #########################################################################
        # EXTERNAL SOURCES
        set(${APPLICATION_NAME}_SOURCES ${${APPLICATION_NAME}_SOURCES} ${${APPLICATION_NAME_CMAKE}_ADDITIONAL_SOURCES})
        
        # CMAKE TARGET DEFINITION
        add_executable(${APPLICATION_TARGET_NAME} ${${APPLICATION_NAME}_SOURCES})
        
        
        
        #########################################################################
        #                                                                       #
        #   COMPILATION FLAG                                                    #
        #                                                                       #
        #   * Flags are options to give to the compiler                         #
        #   * Add user input flags                                              #
        #   * Add platform specific flags                                       #
        #                                                                       #
        #########################################################################

        # USER INPUT COMPILER FLAG
        if(${APPLICATION_NAME_CMAKE}_DEFINES)
          foreach (FLAG ${${APPLICATION_NAME_CMAKE}_DEFINES})
            add_definitions(-D${FLAG})
          endforeach()
        endif()
        
        # USER INPUT CUSTOM COMPILER FLAG
        if(${APPLICATION_NAME_CMAKE}_CXX_FLAGS)
          foreach (FLAG ${${APPLICATION_NAME_CMAKE}_CXX_FLAGS})
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
          endforeach()
        endif()
       
        
        
        #########################################################################
        #                                                                       #
        #   LINKING                                                             #
        #                                                                       #
        #   * Linking is the last stage of compilation                          #
        #   * Indicate what libraries to use for linking the target             #
        #                                                                       #
        #########################################################################
        # LINKING LIBRARIES
        target_link_libraries(${APPLICATION_TARGET_NAME} ${CAMITK_CORE_LIBRARIES} ${CAMITK_LIBRARIES}  ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CEP_LIBRARIES} ${QT_MODULES_LIBRARIES} ${XERCESC_LIBRARY} ${ITK_LIBRARIES} ${PYTHON_LIBRARIES} ${EXTERNAL_LIBRARIES})

        

        #########################################################################
        #                                                                       #
        #   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  #
        #                                                                       #
        #########################################################################
      
        # OUTPUT NAME
        if (MSVC)
            set_target_properties(${APPLICATION_TARGET_NAME}
                                  PROPERTIES OUTPUT_NAME camitk-${APPLICATION_NAME}
                                  DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX}
            )
        else()
            set_target_properties(${APPLICATION_TARGET_NAME}
                                  PROPERTIES OUTPUT_NAME camitk-${APPLICATION_NAME}
            )
        endif()

        # OUTPUT DIRECTORY LOCATION
        # always in bin folder
        set_target_properties(${APPLICATION_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
                                                                    RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
                                                                    RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
        )    
    
        #########################################################################
        #                                                                       #
        #   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 application
        install(TARGETS ${APPLICATION_TARGET_NAME}
                RUNTIME DESTINATION bin
                COMPONENT ${APPLICATION_TARGET_NAME}
        )
    
    
    
        #########################################################################
        #                                                                       #
        #   PROJECT DEPENDENCIES                                                #
        #                                                                       #
        #   * Add in this section library dependencies to other camitk projects #
        #     to keep a correct build order.                                    #
        #                                                                       #
        #########################################################################
        
        # CAMITKCORE LIBRARY DEPENDENCY
        add_dependencies(${APPLICATION_TARGET_NAME} ${CAMITK_CORE_TARGET_LIB_NAME})
        
        # COMPONENTS DEPENDENCIES
        if(${APPLICATION_NAME_CMAKE}_NEEDS_COMPONENT_EXTENSION)
            foreach(COMPONENT_NEEDED ${${APPLICATION_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 (APPLICATION_${APPLICATION_NAME_CMAKE}_INTERNAL)
                    # TODO add IMPORTED
                    add_dependencies(${APPLICATION_TARGET_NAME} component-${COMPONENT_NEEDED})
                endif()
            endforeach()
        endif()

        # ACTIONS DEPENDENCIES
        if(${APPLICATION_NAME_CMAKE}_NEEDS_ACTION_EXTENSION)
          foreach(ACTION_NEEDED ${${APPLICATION_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 (APPLICATION_${APPLICATION_NAME_CMAKE}_INTERNAL)
                # TODO add IMPORTED
                add_dependencies(${APPLICATION_TARGET_NAME} action-${ACTION_NEEDED})
            endif()
          endforeach()
        endif()
    
        # CEP LIBRARIES DEPENDENCIES
        if(${APPLICATION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
            foreach(CEP_LIBRARY_NEEDED ${${APPLICATION_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
                if(PACKAGING_NSIS)
                    add_dependencies(${APPLICATION_TARGET_NAME} ${CEP_LIBRARY_NEEDED})
                else()
                    add_dependencies(${APPLICATION_TARGET_NAME} ${CEP_LIBRARY_NEEDED})
                endif()
            endforeach()
        endif() 
        
        
        
        #########################################################################
        #                                                                       #
        #   CDASH SUBPROJECT DESCRIPTION                                        #
        #                                                                       #
        #   * Update the XML descriton of the subprojects dependenicies         #
        #     for CDash.                                                        #
        #                                                                       #
        #########################################################################       
        # CDASH XML SUBPROJECTS DESCRIPTION UPDATE
        camitk_sub_project_add(APPLICATION ${APPLICATION_TARGET_NAME} DEPENDENCIES ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CAMITK_CORE_LIB_NAME} ${CEP_LIBRARIES})
        
        
        
        #########################################################################
        #                                                                       #
        #   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(${APPLICATION_NAME_CMAKE}_CEP_NAME)
            if (${APPLICATION_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(${APPLICATION_TARGET_NAME}
                                    DISPLAY_NAME ${APPLICATION_TARGET_NAME}
                                    DESCRIPTION ${${APPLICATION_NAME_CMAKE}_DESCRIPTION}
                                    REQUIRED
                                    GROUP SDK
                                    )
            
            else()
                # Extension is selectable for installation in the wizard of the installer
                cpack_add_component(${APPLICATION_TARGET_NAME}
                                    DISPLAY_NAME ${APPLICATION_TARGET_NAME}
                                    DESCRIPTION ${${APPLICATION_NAME_CMAKE}_DESCRIPTION}
                                    GROUP ${${APPLICATION_NAME_CMAKE}_CEP_NAME}
                                    )
            endif()
        else()
            # Extension if not categorized for packaging presentation
            cpack_add_component(${APPLICATION_TARGET_NAME}
                                DISPLAY_NAME ${APPLICATION_TARGET_NAME}
                                DESCRIPTION ${${APPLICATION_NAME_CMAKE}_DESCRIPTION}
                                )
        
        endif()

        # additional unix system files/resources
        if(UNIX)
            # Man page installation
            set(${APPLICATION_NAME_CMAKE}_MAN_PAGE ${CMAKE_CURRENT_SOURCE_DIR}/resources/camitk-${APPLICATION_NAME}.1)
            if (EXISTS ${${APPLICATION_NAME_CMAKE}_MAN_PAGE})
                message(STATUS "Found man page for ${APPLICATION_TARGET_NAME}")
                install(FILES ${${APPLICATION_NAME_CMAKE}_MAN_PAGE}
                        DESTINATION ${CAMITK_APPLICATION_MAN_INSTALL_DIR}
                )
            else()
                # check if .in exists
                if (EXISTS ${${APPLICATION_NAME_CMAKE}_MAN_PAGE}.in)
                    message(STATUS "Found man page configuration file for ${APPLICATION_TARGET_NAME}")
                    install(CODE "message(STATUS \"Updating ${APPLICATION_NAME} man page (version ${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR} as of ${CURRENT_DATE})\")")
                    # set variable in sub-cmake shell
                    install(CODE "set(APPLICATION_NAME ${APPLICATION_NAME})")
                    install(CODE "set(CURRENT_DATE ${CURRENT_DATE})")
                    install(CODE "set(CAMITK_VERSION_MAJOR ${CAMITK_VERSION_MAJOR})")
                    install(CODE "set(CAMITK_VERSION_MINOR ${CAMITK_VERSION_MINOR})")
                    # remove previous version
                    install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_CURRENT_BINARY_DIR}/camitk-${APPLICATION_NAME}.1)")
                    # configure current version
                    install(CODE "configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/camitk-${APPLICATION_NAME}.1.in ${CMAKE_CURRENT_BINARY_DIR}/camitk-${APPLICATION_NAME}.1 @ONLY)")
                    # install file
                    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/camitk-${APPLICATION_NAME}.1 DESTINATION ${CAMITK_APPLICATION_MAN_INSTALL_DIR})
                endif()
            endif()

            # Desktop file
            set(${APPLICATION_NAME_CMAKE}_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/resources/camitk-${APPLICATION_NAME}.desktop)
            if (EXISTS ${${APPLICATION_NAME_CMAKE}_DESKTOP})
                message(STATUS "Found desktop file for ${APPLICATION_TARGET_NAME}")
                install(FILES ${${APPLICATION_NAME_CMAKE}_DESKTOP} DESTINATION ${CAMITK_APPLICATION_DESKTOP_INSTALL_DIR})
            endif()

            # application pixmap
            set(${APPLICATION_NAME_CMAKE}_PIXMAP ${CMAKE_CURRENT_SOURCE_DIR}/resources/camitk-${APPLICATION_NAME}.xpm)
            if (EXISTS ${${APPLICATION_NAME_CMAKE}_PIXMAP})
                message(STATUS "Found pixmap for ${APPLICATION_TARGET_NAME}")
                install(FILES ${${APPLICATION_NAME_CMAKE}_PIXMAP} DESTINATION ${CAMITK_APPLICATION_PIXMAP_INSTALL_DIR})
            endif()
            
        endif()

    endif() #APPLICATION_${APPLICATION_NAME_CMAKE}

endmacro()