-
Notifications
You must be signed in to change notification settings - Fork 16
/
DocTools.cmake
2004 lines (1968 loc) · 80 KB
/
DocTools.cmake
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
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ============================================================================
# Copyright (c) 2011-2012 University of Pennsylvania
# Copyright (c) 2013-2014 Carnegie Mellon University
# Copyright (c) 2013-2014 Andreas Schuh
# All rights reserved.
#
# See COPYING file for license information or visit
# http://opensource.andreasschuh.com/cmake-basis/download.html#license
# ============================================================================
##############################################################################
# @file DocTools.cmake
# @brief Tools related to gnerating or adding software documentation.
#
# @ingroup CMakeTools
##############################################################################
if (__BASIS_DOCTOOLS_INCLUDED)
return ()
else ()
set (__BASIS_DOCTOOLS_INCLUDED TRUE)
endif ()
# ============================================================================
# adding / generating documentation
# ============================================================================
# ----------------------------------------------------------------------------
## @brief Add documentation target.
#
# This function is used to add a software documentation files to the project
# which are either just copied to the installation or generated from input
# files such as in particular source code files and documentation files
# marked up using one of the supported lightweight markup languages.
#
# The supported generators are:
# <table border="0">
# <tr>
# @tp @b None @endtp
# <td>This generator simply installs the given file or all files within
# the specified directory.</td>
# </tr>
# <tr>
# @tp @b Doxygen @endtp
# <td>Used to generate API documentation from in-source code comments and
# other related files marked up using Doxygen comments. See
# basis_add_doxygen_doc() for more details.</td>
# </tr>
# <tr>
# @tp @b Sphinx @endtp
# <td>Used to generate documentation such as a web site from reStructuredText.
# See basis_add_sphinx_doc() for more details.</td>
# </tr>
# </table>
#
# @param [in] TARGET_NAME Name of the documentation target or file.
# @param [in] ARGN Documentation generator as "GENERATOR generator" option
# and additional arguments for the particular generator.
# The case of the generator name is ignored, i.e.,
# @c Doxygen, @c DOXYGEN, @c doxYgen are all valid arguments
# which select the @c Doxygen generator. The default generator
# is the @c None generator.</td>
#
# @returns Adds a custom target @p TARGET_NAME for the generation of the
# documentation.
#
# @sa basis_install_doc()
# @sa basis_add_doxygen_doc()
# @sa basis_add_sphinx_doc()
#
# @ingroup CMakeAPI
function (basis_add_doc TARGET_NAME)
CMAKE_PARSE_ARGUMENTS (ARGN "" "GENERATOR" "" ${ARGN})
if (NOT ARGN_GENERATOR)
set (ARGN_GENERATOR "NONE")
else ()
string (TOUPPER "${ARGN_GENERATOR}" ARGN_GENERATOR)
endif ()
if (ARGN_GENERATOR MATCHES "NONE")
basis_install_doc (${TARGET_NAME} ${ARGN_UNPARSED_ARGUMENTS})
elseif (ARGN_GENERATOR MATCHES "DOXYGEN")
basis_add_doxygen_doc (${TARGET_NAME} ${ARGN_UNPARSED_ARGUMENTS})
elseif (ARGN_GENERATOR MATCHES "SPHINX")
basis_add_sphinx_doc (${TARGET_NAME} ${ARGN_UNPARSED_ARGUMENTS})
else ()
message (FATAL_ERROR "Unknown documentation generator: ${ARGN_GENERATOR}.")
endif ()
endfunction ()
# ----------------------------------------------------------------------------
## @brief Install documentation file(s).
#
# This function either adds an installation rule for a single documentation
# file or a directory containing multiple documentation files.
#
# Example:
# @code
# basis_install_doc ("User Manual.pdf" OUTPUT_NAME "BASIS User Manual.pdf")
# basis_install_doc (DeveloperManual.docx COMPONENT dev)
# basis_install_doc (SourceManual.html COMPONENT src)
# @endcode
#
# @param [in] SOURCE Documentation file or directory to install.
# @param [in] ARGN List of optional arguments. Valid arguments are:
# @par
# <table border="0">
# <tr>
# @tp @b COMPONENT component @endtp
# <td>Name of the component this documentation belongs to.
# Defaults to @c BASIS_RUNTIME_COMPONENT.</td>
# </tr>
# <tr>
# @tp @b DESTINATION dir @endtp
# <td>Installation directory prefix. Defaults to @c INSTALL_DOC_DIR.</td>
# </tr>
# <tr>
# @tp @b OUTPUT_NAME name @endtp
# <td>Name of file or directory after installation.</td>
# </tr>
# </table>
#
# @sa basis_add_doc()
function (basis_install_doc SOURCE)
CMAKE_PARSE_ARGUMENTS (ARGN "" "COMPONENT;DESTINATION;OUTPUT_NAME" "" ${ARGN})
if (NOT IS_ABSOLUTE "${SOURCE}")
get_filename_component (SOURCE "${SOURCE}" ABSOLUTE)
endif ()
if (NOT ARGN_DESTINATION)
set (ARGN_DESTINATION "${INSTALL_DOC_DIR}")
endif ()
if (NOT ARGN_COMPONENT)
set (ARGN_COMPONENT "${BASIS_RUNTIME_COMPONENT}")
endif ()
if (NOT ARGN_COMPONENT)
set (ARGN_COMPONENT "Unspecified")
endif ()
if (NOT ARGN_OUTPUT_NAME)
basis_get_filename_component (ARGN_OUTPUT_NAME "${SOURCE}" NAME)
endif ()
basis_get_relative_path (
RELPATH
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/${ARGN_OUTPUT_NAME}"
)
message (STATUS "Adding documentation ${RELPATH}...")
if (IS_DIRECTORY "${SOURCE}")
basis_install_directory (
"${SOURCE}" "${ARGN_DESTINATION}/${ARGN_OUTPUT_NAME}"
COMPONENT "${ARGN_COMPONENT}"
)
else ()
install (
FILES "${SOURCE}"
DESTINATION "${ARGN_DESTINATION}"
COMPONENT "${ARGN_COMPONENT}"
RENAME "${ARGN_OUTPUT_NAME}"
)
endif ()
message (STATUS "Adding documentation ${RELPATH}... - done")
endfunction ()
# ----------------------------------------------------------------------------
## @brief Add documentation to be generated by Doxygen.
#
# This function adds a build target to generate documentation from in-source
# code comments and other related project pages using
# <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a>.
#
# @param [in] TARGET_NAME Name of the documentation target.
# @param [in] ARGN List of arguments. The valid arguments are:
# @par
# <table border="0">
# <tr>
# @tp @b EXCLUDE_FROM_DOC @endtp
# <td>By default, the specified target is build as part of the global
# @c doc target. If this option is given, however, the added
# documentation will not be build as part of this target.</td>
# </tr>
# <tr>
# @tp @b COMPONENT component @endtp
# <td>Name of the component this documentation belongs to.
# Defaults to @c BASIS_LIBRARY_COMPONENT.</td>
# </tr>
# <tr>
# @tp @b DESTINATION dir @endtp
# <td>Installation directory prefix. Defaults to
# @c BASIS_INSTALL_<TARGET>_DIR in case of HTML output if set.
# Otherwise, the generated HTML files are not installed.</td>
# </tr>
# <tr>
# @tp @b DOXYFILE file @endtp
# <td>Name of the template Doxyfile.</td>
# </tr>
# <tr>
# @tp @b PROJECT_NAME name @endtp
# <td>Value for Doxygen's @c PROJECT_NAME tag which is used to
# specify the project name.@n
# Default: @c PROJECT_NAME.</td>
# </tr>
# <tr>
# @tp @b PROJECT_NUMBER version @endtp
# <td>Value for Doxygen's @c PROJECT_NUMBER tag which is used
# to specify the project version number.@n
# Default: @c PROJECT_RELEASE.</td>
# </tr>
# <tr>
# @tp @b PROJECT_WEBSITE url @endtp
# <td>Used for links to project website.@n
# Default: @c PROJECT_PACKAGE_WEBSITE </td>
# </tr>
# <tr>
# @tp @b INPUT path1 [path2 ...] @endtp
# <td>Value for Doxygen's @c INPUT tag which is used to specify input
# directories/files. Any given input path is added to the default
# input paths.@n
# Default: @c PROJECT_CODE_DIRS, @c BINARY_CODE_DIR,
# @c PROJECT_INCLUDE_DIRS, @c BINARY_INCLUDE_DIR.</td>
# </tr>
# <tr>
# @tp @b INPUT_FILTER filter @endtp
# <td>
# Value for Doxygen's @c INPUT_FILTER tag which can be used to
# specify a default filter for all input files.@n
# Default: @c doxyfilter of BASIS.
# </td>
# </tr>
# <tr>
# @tp @b FILTER_PATTERNS pattern1 [pattern2...] @endtp
# <td>Value for Doxygen's @c FILTER_PATTERNS tag which can be used to
# specify filters on a per file pattern basis.@n
# Default: None.</td>
# </tr>
# <tr>
# @tp @b INCLUDE_PATH path1 [path2...] @endtp
# <td>Doxygen's @c INCLUDE_PATH tag can be used to specify one or more
# directories that contain include files that are not input files
# but should be processed by the preprocessor. Any given directories
# are appended to the default include path considered.
# Default: Directories added by basis_include_directories().</td>
# </tr>
# <tr>
# @tp @b EXCLUDE_PATTERNS pattern1 [pattern2 ...] @endtp
# <td>Additional patterns used for Doxygen's @c EXCLUDE_PATTERNS tag
# which can be used to specify files and/or directories that
# should be excluded from the INPUT source files.@n
# Default: No exclude patterns.</td>
# </tr>
# <tr>
# @tp @b OUTPUT fmt @endtp
# <td>Specify output formats in which to generate the documentation.
# Currently, only @c html and @c xml are supported.</td>
# </tr>
# <tr>
# @tp @b OUTPUT_DIRECTORY dir @endtp
# <td>Value for Doxygen's @c OUTPUT_DIRECTORY tag which can be used to
# specify the output directory. The output files are written to
# subdirectories named "html", "latex", "rtf", and "man".@n
# Default: <tt>CMAKE_CURRENT_BINARY_DIR/TARGET_NAME</tt>.</td>
# </tr>
# <tr>
# @tp @b COLS_IN_ALPHA_INDEX n @endtp
# <td>Number of columns in alphabetical index. Default: 3.</td>
# </tr>
# <tr>
# @tp @b IGNORE_PREFIX prefix1 [prefix2...] @endtp
# <td>In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.</td>
# </tr>
# <tr>
# @tp @b PROVIDER_NAME name @endtp
# <td>Value for provider name, such as a company name,
# that will be used for pages in the doxygen output.@n
# Default: @c PROJECT_PROVIDER_NAME.</td>
# </tr>
# <tr>
# @tp @b PROVIDER_WEBSITE url @endtp
# <td>Value for provider website, such as a company website,
# that will be used for pages in the doxygen output.@n
# Default: @c PROJECT_PROVIDER_WEBSITE.</td>
# </tr>
# <tr>
# @tp @b PROVIDER_LOGO image_file @endtp
# <td>Value for provider logo file, such as a company logo,
# that will be used for pages in the doxygen output.@n
# Default: @c PROJECT_PROVIDER_LOGO.</td>
# </tr>
# <tr>
# @tp @b DIVISION_NAME name @endtp
# <td>Value for division name, such as a company division name,
# that will be used for pages in the doxygen output.@n
# Default: @c PROJECT_DIVISION_NAME.</td>
# </tr>
# <tr>
# @tp @b DIVISION_WEBSITE url @endtp
# <td>Value for division website, such as a company division website,
# that will be used for pages in the doxygen output.@n
# Default: @c PROJECT_DIVISION_WEBSITE.</td>
# </tr>
# <tr>
# @tp @b DIVISION_LOGO image_file @endtp
# <td>Value for division logo file, such as a company division logo,
# that will be used for pages in the doxygen output.@n
# Default: @c PROJECT_DIVISION_LOGO.</td>
# </tr>
# <tr>
# @tp @b ENABLED_SECTIONS section1 [section2 ...] @endtp
# <td>The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by "\if sectionname ... \endif".</td>
# </tr>
# <tr>
# @tp @b HTML_HEADER html_file @endtp
# <td>The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If none specified, the
# @c "PROJECT_SOURCE_DIR/doc/doxygen_header.html(.in)?" file is used if present.
# Otherwise, a default header is used. Specify the value @c Doxygen to use the
# standard header generated by Doxygen instead.</td>
# </tr>
# <tr>
# @tp @b HTML_FOOTER html_file @endtp
# <td>The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If none specified, the
# @c "PROJECT_SOURCE_DIR/doc/doxygen_footer.html(.in)?" file is used if present.
# Otherwise, a default footer is used. Specify the value @c Doxygen to use the
# standard footer generated by Doxygen instead.</td>
# </tr>
# <tr>
# @tp @b HTML_EXTRA_STYLESHEET css_file @endtp
# <td>The HTML_EXTRA_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If none specified, the
# @c "PROJECT_SOURCE_DIR/doc/doxygen_extra.css(.in)?" file is used if present.</td>
# </tr>
# <tr>
# @tp @b HTML_EXTRA_FILES file1 [file2...] @endtp
# <td>The HTML_EXTRA_FILES tag can be used to specify additional files needed
# for the HTML output of the API documentation.</td>
# </tr>
# <tr>
# @tp @b DISABLE_PROJECT_NAME_DISPLAY@endtp
# <td>The DISABLE_PROJECT_NAME_DISPLAY option causes Doxygen's
# @c PROJECT_NAME text not to be displayed in the header.
# Use this if the project name is already part of the logo
# so it won't be there twice in the logo image and title text.</td>
# </tr>
# </table>
# @n
# See <a href="http://www.stack.nl/~dimitri/doxygen/manual/config.html">here</a> for a
# documentation of the Doxygen tags.
# @n@n
# Example:
# @code
# basis_add_doxygen_doc (
# apidoc
# DOXYFILE "Doxyfile.in"
# PROJECT_NAME "${PROJECT_NAME}"
# PROJECT_VERSION "${PROJECT_VERSION}"
# COMPONENT dev
# )
# @endcode
#
# @sa basis_add_doc()
function (basis_add_doxygen_doc TARGET_NAME)
# check target name
basis_check_target_name ("${TARGET_NAME}")
basis_make_target_uid (TARGET_UID "${TARGET_NAME}")
string (TOLOWER "${TARGET_NAME}" TARGET_NAME_L)
string (TOUPPER "${TARGET_NAME}" TARGET_NAME_U)
# verbose output
message (STATUS "Adding documentation ${TARGET_UID}...")
# find Doxygen
find_package (Doxygen QUIET)
if (NOT DOXYGEN_EXECUTABLE)
if (BUILD_DOCUMENTATION)
message (FATAL_ERROR "Doxygen not found! Either install Doxygen and/or set DOXYGEN_EXECUTABLE or disable BUILD_DOCUMENTATION.")
endif ()
message (STATUS "Doxygen not found. Generation of ${TARGET_UID} documentation disabled.")
message (STATUS "Adding documentation ${TARGET_UID}... - skipped")
return ()
endif ()
# parse arguments
set (VALUEARGS
PROJECT_NAME
PROJECT_NUMBER
PROJECT_WEBSITE
PROVIDER_NAME
PROVIDER_WEBSITE
DIVISION_NAME
DIVISION_WEBSITE
COMPONENT
DESTINATION
HTML_DESTINATION
MAN_DESTINATION
OUTPUT_DIRECTORY
COLS_IN_ALPHA_INDEX
MAN_SECTION
)
set (OPTIONAL_FILE_OPTIONS
HTML_FOOTER
HTML_HEADER
HTML_EXTRA_STYLESHEET
PROJECT_LOGO
PROVIDER_LOGO
DIVISION_LOGO
DOXYFILE
TAGFILE
)
CMAKE_PARSE_ARGUMENTS (
DOXYGEN
"EXCLUDE_FROM_DOC;DISABLE_PROJECT_NAME_DISPLAY"
"${VALUEARGS};${OPTIONAL_FILE_OPTIONS}"
"INPUT;OUTPUT;INPUT_FILTER;FILTER_PATTERNS;EXCLUDE_PATTERNS;INCLUDE_PATH;IGNORE_PREFIX;ENABLED_SECTIONS;HTML_EXTRA_FILES"
${ARGN}
)
unset (VALUEARGS)
# handle special arguments
set (DOXYGEN_HTML_HEADER_IS_DEFAULT FALSE)
if (DOXYGEN_HTML_HEADER MATCHES "^(Doxygen|doxygen|DOXYGEN|none|None|NONE)$")
set (DOXYGEN_HTML_HEADER)
elseif (NOT DOXYGEN_HTML_HEADER OR DOXYGEN_HTML_HEADER MATCHES "^(Default|default|DEFAULT)$")
set (DOXYGEN_HTML_HEADER "${BASIS_MODULE_PATH}/doxygen_header.html.in")
set (DOXYGEN_HTML_HEADER_IS_DEFAULT TRUE)
endif ()
if (DOXYGEN_HTML_FOOTER MATCHES "^(Doxygen|doxygen|DOXYGEN|none|None|NONE)$")
set (DOXYGEN_HTML_FOOTER)
elseif (NOT DOXYGEN_HTML_FOOTER OR DOXYGEN_HTML_FOOTER MATCHES "^(Default|default|DEFAULT)$")
set (DOXYGEN_HTML_FOOTER "${BASIS_MODULE_PATH}/doxygen_footer.html.in")
endif ()
# make file paths absolute and check if files exist
foreach (opt IN LISTS OPTIONAL_FILE_OPTIONS)
if (DOXYGEN_${opt})
get_filename_component (DOXYGEN_${opt} "${DOXYGEN_${opt}}" ABSOLUTE)
if (NOT EXISTS "${DOXYGEN_${opt}}")
message (FATAL_ERROR "File ${DOXYGEN_${opt}} does not exist. Check value of the ${opt} option and make sure the file is present.")
endif ()
endif ()
endforeach ()
set (TMP_DOXYGEN_HTML_EXTRA_FILES)
foreach (path IN LISTS DOXYGEN_HTML_EXTRA_FILES)
get_filename_component (abspath "${path}" ABSOLUTE)
if (NOT EXISTS "${path}")
message (FATAL_ERROR "File ${path} does not exist. Check value of the HTML_EXTRA_FILES option and make sure the file is present.")
endif ()
list (APPEND TMP_DOXYGEN_HTML_EXTRA_FILES "${path}")
endforeach ()
set (DOXYGEN_HTML_EXTRA_FILES "${TMP_DOXYGEN_HTML_EXTRA_FILES}")
unset (TMP_DOXYGEN_HTML_EXTRA_FILES)
# default component
if (NOT DOXYGEN_COMPONENT)
set (DOXYGEN_COMPONENT "${BASIS_LIBRARY_COMPONENT}")
endif ()
if (NOT DOXYGEN_COMPONENT)
set (DOXYGEN_COMPONENT "Unspecified")
endif ()
# configuration file
if (NOT DOXYGEN_DOXYFILE)
set (DOXYGEN_DOXYFILE "${BASIS_DOXYGEN_DOXYFILE}")
endif ()
if (NOT EXISTS "${DOXYGEN_DOXYFILE}")
message (FATAL_ERROR "Missing option DOXYGEN_FILE or Doxyfile ${DOXYGEN_DOXYFILE} does not exist.")
endif ()
# default project attributes and logos
if (NOT DOXYGEN_PROJECT_NAME)
set (DOXYGEN_PROJECT_NAME "${PROJECT_NAME}")
endif ()
if (NOT DOXYGEN_PROJECT_NUMBER)
set (DOXYGEN_PROJECT_NUMBER "${PROJECT_RELEASE}")
endif ()
if (NOT DOXYGEN_PROJECT_LOGO)
set (DOXYGEN_PROJECT_LOGO "${PROJECT_PACKAGE_LOGO}")
elseif (DOXYGEN_PROJECT_LOGO MATCHES "^None|none|NONE$")
set (DOXYGEN_PROJECT_LOGO)
endif ()
if (NOT DOXYGEN_PROJECT_WEBSITE)
set (DOXYGEN_PROJECT_WEBSITE "${PROJECT_PACKAGE_WEBSITE}")
endif ()
if (NOT DOXYGEN_PROVIDER_NAME)
set (DOXYGEN_PROVIDER_NAME "${PROJECT_PROVIDER_NAME}")
endif ()
if (NOT DOXYGEN_PROVIDER_WEBSITE)
set (DOXYGEN_PROVIDER_WEBSITE "${PROJECT_PROVIDER_WEBSITE}")
endif ()
if (NOT DOXYGEN_PROVIDER_LOGO)
set (DOXYGEN_PROVIDER_LOGO "${PROJECT_PROVIDER_LOGO}")
endif ()
if (NOT DOXYGEN_DIVISION_NAME)
set (DOXYGEN_DIVISION_NAME "${PROJECT_DIVISION_NAME}")
endif ()
if (NOT DOXYGEN_DIVISION_WEBSITE)
set (DOXYGEN_DIVISION_WEBSITE "${PROJECT_DIVISION_WEBSITE}")
endif ()
if (NOT DOXYGEN_DIVISION_LOGO)
set (DOXYGEN_DIVISION_LOGO "${PROJECT_DIVISION_LOGO}")
endif ()
# set visibility property of project logos
if (DOXYGEN_PROJECT_LOGO)
set (DOXYGEN_PROJECT_LOGO_DISPLAY "block")
else ()
set (DOXYGEN_PROJECT_LOGO_DISPLAY "none")
endif ()
if (DOXYGEN_PROVIDER_LOGO)
set (DOXYGEN_PROVIDER_LOGO_DISPLAY "inline")
else ()
set (DOXYGEN_PROVIDER_LOGO_DISPLAY "block")
endif ()
if (DOXYGEN_DIVISION_LOGO)
set (DOXYGEN_DIVISION_LOGO_DISPLAY "inline")
else ()
set (DOXYGEN_DIVISION_LOGO_DISPLAY "block")
endif ()
# allow the user to disable the text header if desired
if(DOXYGEN_DISABLE_PROJECT_NAME_DISPLAY)
set (DOXYGEN_PROJECT_NAME_DISPLAY "none")
else()
set (DOXYGEN_PROJECT_NAME_DISPLAY "inline")
endif()
# standard input files
list (APPEND DOXYGEN_INPUT "${PROJECT_SOURCE_DIR}/BasisProject.cmake")
if (EXISTS "${PROJECT_CONFIG_DIR}/Depends.cmake")
list (APPEND DOXYGEN_INPUT "${PROJECT_CONFIG_DIR}/Depends.cmake")
endif ()
if (EXISTS "${BINARY_CONFIG_DIR}/Directories.cmake")
list (APPEND DOXYGEN_INPUT "${BINARY_CONFIG_DIR}/Directories.cmake")
endif ()
if (EXISTS "${BINARY_CONFIG_DIR}/BasisSettings.cmake")
list (APPEND DOXYGEN_INPUT "${BINARY_CONFIG_DIR}/BasisSettings.cmake")
endif ()
if (EXISTS "${BINARY_CONFIG_DIR}/ProjectSettings.cmake")
list (APPEND DOXYGEN_INPUT "${BINARY_CONFIG_DIR}/ProjectSettings.cmake")
endif ()
if (EXISTS "${BINARY_CONFIG_DIR}/Settings.cmake")
list (APPEND DOXYGEN_INPUT "${BINARY_CONFIG_DIR}/Settings.cmake")
elseif (EXISTS "${PROJECT_CONFIG_DIR}/Settings.cmake")
list (APPEND DOXYGEN_INPUT "${PROJECT_CONFIG_DIR}/Settings.cmake")
endif ()
if (EXISTS "${BASIS_SCRIPT_CONFIG_FILE}")
list (APPEND DOXYGEN_INPUT "${BASIS_SCRIPT_CONFIG_FILE}")
endif ()
if (EXISTS "${BINARY_CONFIG_DIR}/ScriptConfig.cmake")
list (APPEND DOXYGEN_INPUT "${BINARY_CONFIG_DIR}/ScriptConfig.cmake")
endif ()
if (EXISTS "${PROJECT_CONFIG_DIR}/ConfigSettings.cmake")
list (APPEND DOXYGEN_INPUT "${PROJECT_CONFIG_DIR}/ConfigSettings.cmake")
endif ()
if (EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
list (APPEND DOXYGEN_INPUT "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
endif ()
if (EXISTS "${PROJECT_BINARY_DIR}/CTestCustom.cmake")
list (APPEND DOXYGEN_INPUT "${PROJECT_BINARY_DIR}/CTestCustom.cmake")
endif ()
# package configuration files - only exist *after* this function executed
list (APPEND DOXYGEN_INPUT "${BINARY_CONFIG_DIR}/${PROJECT_PACKAGE_CONFIG_PREFIX}Config.cmake")
list (APPEND DOXYGEN_INPUT "${PROJECT_BINARY_DIR}/${PROJECT_PACKAGE_CONFIG_PREFIX}ConfigVersion.cmake")
list (APPEND DOXYGEN_INPUT "${PROJECT_BINARY_DIR}/${PROJECT_PACKAGE_CONFIG_PREFIX}Use.cmake")
# input directories
foreach (_DIR IN LISTS BINARY_INCLUDE_DIR PROJECT_INCLUDE_DIRS BINARY_CODE_DIR PROJECT_CODE_DIRS)
if (IS_DIRECTORY ${_DIR})
list (APPEND DOXYGEN_INPUT "${_DIR}")
endif ()
endforeach ()
foreach (M IN LISTS PROJECT_MODULES_ENABLED)
foreach (_DIR IN LISTS ${M}_INCLUDE_DIRS ${M}_CODE_DIRS)
if (IS_DIRECTORY ${_DIR})
list (APPEND DOXYGEN_INPUT "${_DIR}")
endif ()
endforeach ()
endforeach ()
# in case of scripts, have Doxygen process the configured versions for the
# installation which are further located in proper subdirectories instead
# of the original source files
basis_get_project_property (TARGETS)
foreach (T IN LISTS TARGETS)
get_target_property (BASIS_TYPE ${T} BASIS_TYPE)
get_target_property (IS_TEST ${T} TEST)
if (NOT IS_TEST AND BASIS_TYPE MATCHES "SCRIPT")
get_target_property (SOURCES ${T} SOURCES)
if (SOURCES)
list (GET SOURCES 0 BUILD_DIR) # CMake <3.1 stores path to internal build directory here
if (BUILD_DIR MATCHES "CMakeFiles")
list (REMOVE_AT SOURCES 0)
endif ()
get_target_property (BUILD_DIR ${T} BUILD_DIRECTORY)
list (APPEND DOXYGEN_INPUT "${BUILD_DIR}.dir/build")
foreach (S IN LISTS SOURCES)
list (APPEND DOXYGEN_EXCLUDE_PATTERNS "${S}")
endforeach ()
endif ()
endif ()
endforeach ()
# add .dox files as input
file (GLOB_RECURSE DOX_FILES "${PROJECT_DOC_DIR}/*.dox")
list (SORT DOX_FILES) # alphabetic order
list (APPEND DOXYGEN_INPUT ${DOX_FILES})
# add .dox files of BASIS modules
list (APPEND DOXYGEN_INPUT "${BASIS_MODULE_PATH}/Modules.dox")
# add .dox files of used BASIS utilities
list (APPEND DOXYGEN_INPUT "${BASIS_MODULE_PATH}/Utilities.dox")
list (APPEND DOXYGEN_INPUT "${BASIS_MODULE_PATH}/CxxUtilities.dox")
foreach (L IN ITEMS Cxx Java Python Perl Bash Matlab)
string (TOUPPER "${L}" U)
basis_get_project_property (USES_${U}_UTILITIES PROPERTY PROJECT_USES_${U}_UTILITIES)
if (USES_${U}_UTILITIES)
list (FIND DOXYGEN_INPUT "${BASIS_MODULE_PATH}/Utilities.dox" IDX)
if (IDX EQUAL -1)
list (APPEND DOXYGEN_INPUT "${BASIS_MODULE_PATH}/Utilities.dox")
endif ()
list (APPEND DOXYGEN_INPUT "${BASIS_MODULE_PATH}/${L}Utilities.dox")
endif ()
endforeach ()
# include path - Disabled as this increases the runtime of Doxygen but
# generally the source of third-party packages are not
# really referenced. Only the source files of this
# project have to be considered. This code is kept as it
# might be used again at a later point once it is figured
# how Doxygen can be only rerun if necessary.
#basis_get_project_property (INCLUDE_DIRS PROPERTY PROJECT_INCLUDE_DIRS)
#foreach (D IN LISTS INCLUDE_DIRS)
# list (FIND DOXYGEN_INPUT "${D}" IDX)
# if (IDX EQUAL -1)
# list (APPEND DOXYGEN_INCLUDE_PATH "${D}")
# endif ()
#endforeach ()
#basis_list_to_delimited_string (
# DOXYGEN_INCLUDE_PATH "\"\nINCLUDE_PATH += \"" ${DOXYGEN_INCLUDE_PATH}
#)
#set (DOXYGEN_INCLUDE_PATH "\"${DOXYGEN_INCLUDE_PATH}\"")
# make string from DOXYGEN_INPUT - after include path was set
basis_list_to_delimited_string (
DOXYGEN_INPUT "\"\nINPUT += \"" ${DOXYGEN_INPUT}
)
set (DOXYGEN_INPUT "\"${DOXYGEN_INPUT}\"")
# outputs
if (NOT DOXYGEN_OUTPUT_DIRECTORY)
set (DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME_L}")
endif ()
if (DOXYGEN_TAGFILE MATCHES "^(None|NONE|none)$")
set (DOXYGEN_TAGFILE)
else ()
set (DOXYGEN_TAGFILE "${DOXYGEN_OUTPUT_DIRECTORY}/Doxytags.${TARGET_NAME_L}")
endif ()
if (NOT DOXYGEN_OUTPUT)
set (DOXYGEN_OUTPUT html)
endif ()
foreach (F IN ITEMS HTML XML RTF LATEX MAN)
set (DOXYGEN_GENERATE_${F} NO)
endforeach ()
foreach (f IN LISTS DOXYGEN_OUTPUT)
if (NOT f MATCHES "^(html|xml)$")
message (FATAL_ERROR "Invalid/Unsupported Doxygen output format: ${f}")
endif ()
string (TOUPPER "${f}" F)
set (DOXYGEN_GENERATE_${F} YES) # enable generation of this output
set (DOXYGEN_${F}_OUTPUT "${f}") # relative output directory
endforeach ()
# input filters
if (NOT DOXYGEN_INPUT_FILTER)
basis_get_target_uid (DOXYFILTER "basis.doxyfilter")
if (TARGET "${DOXYFILTER}")
basis_get_target_location (DOXYGEN_INPUT_FILTER ${DOXYFILTER} ABSOLUTE)
else ()
basis_get_target_uid (DOXYFILTER "doxyfilter")
if (TARGET "${DOXYFILTER}")
basis_get_target_location (DOXYGEN_INPUT_FILTER ${DOXYFILTER} ABSOLUTE)
endif ()
endif ()
else ()
set (DOXYFILTER)
endif ()
if (DOXYGEN_INPUT_FILTER)
if (WIN32)
# Doxygen on Windows (XP, 32-bit) (at least up to version 1.8.0) seems
# to have a problem of not calling filters which have a space character
# in their file path correctly. The doxyfilter.bat Batch program is used
# as a wrapper for the actual filter which is part of the BASIS build.
# As this file is in the working directory of Doxygen, it can be
# referenced relative to this working directory, i.e., without file paths.
# The Batch program itself then calls the actual Doxygen filter with proper
# quotes to ensure that spaces in the file path are handled correctly.
# The file extension .bat shall distinguish this wrapper script from the actual
# doxyfilter.cmd which is generated by BASIS on Windows.
configure_file ("${BASIS_MODULE_PATH}/doxyfilter.bat.in" "${DOXYGEN_OUTPUT_DIRECTORY}/doxyfilter.bat" @ONLY)
set (DOXYGEN_INPUT_FILTER "doxyfilter.bat")
endif ()
endif ()
basis_list_to_delimited_string (
DOXYGEN_FILTER_PATTERNS "\"\nFILTER_PATTERNS += \"" ${DOXYGEN_FILTER_PATTERNS}
)
if (DOXYGEN_FILTER_PATTERNS)
set (DOXYGEN_FILTER_PATTERNS "\"${DOXYGEN_FILTER_PATTERNS}\"")
endif ()
# exclude patterns
list (APPEND DOXYGEN_EXCLUDE_PATTERNS "cmake_install.cmake")
list (APPEND DOXYGEN_EXCLUDE_PATTERNS "CTestTestfile.cmake")
basis_list_to_delimited_string (
DOXYGEN_EXCLUDE_PATTERNS "\"\nEXCLUDE_PATTERNS += \"" ${DOXYGEN_EXCLUDE_PATTERNS}
)
set (DOXYGEN_EXCLUDE_PATTERNS "\"${DOXYGEN_EXCLUDE_PATTERNS}\"")
# section for man pages
if (NOT DOXYGEN_MAN_SECTION)
set (DOXYGEN_MAN_SECTION 3)
endif ()
# other settings
if (NOT DOXYGEN_COLS_IN_ALPHA_INDEX OR DOXYGEN_COLS_IN_ALPHA_INDEX MATCHES "[^0-9]")
set (DOXYGEN_COLS_IN_ALPHA_INDEX 1)
endif ()
basis_list_to_delimited_string (DOXYGEN_IGNORE_PREFIX " " ${DOXYGEN_IGNORE_PREFIX})
# click & jump in emacs and Visual Studio
if (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
set (DOXYGEN_WARN_FORMAT "\"$file($line) : $text \"")
else ()
set (DOXYGEN_WARN_FORMAT "\"$file:$line: $text \"")
endif ()
# installation directories
set (BASIS_INSTALL_${TARGET_NAME_U}_DIR "" CACHE PATH "Installation directory for Doxygen ${TARGET_NAME} target.")
mark_as_advanced (BASIS_INSTALL_${TARGET_NAME_U}_DIR)
foreach (f IN LISTS DOXYGEN_OUTPUT)
string (TOUPPER "${f}" F)
if (BASIS_INSTALL_${TARGET_NAME_U}_DIR)
set (DOXYGEN_${F}_DESTINATION "${BASIS_INSTALL_${TARGET_NAME_U}_DIR}") # user setting
endif ()
if (NOT DOXYGEN_${F}_DESTINATION)
if (DOXYGEN_DESTINATION)
set (DOXYGEN_${F}_DESTINATION "${DOXYGEN_DESTINATION}") # common destination
elseif (f MATCHES "man")
if (INSTALL_MAN_DIR)
set (DOXYGEN_MAN_DESTINATION "${INSTALL_MAN_DIR}/man${DOXYGEN_MAN_SECTION}") # default for manual pages
endif ()
elseif (NOT f MATCHES "html") # do not install excludes by default
set (DOXYGEN_${F}_DESTINATION "${INSTALL_DOC_DIR}") # default destination
endif ()
endif ()
endforeach ()
# determine tool to generate pdf documentation, see USE_PDFLATEX in Doxyfile.in
find_package (LATEX QUIET)
if (PDFLATEX_COMPILER)
set (DOXYGEN_USE_PDFLATEX YES)
else ()
set (DOXYGEN_USE_PDFLATEX NO)
message (STATUS "pdflatex not found. For higher quality PDFs make sure pdflatex is installed and found on the PATH.")
endif ()
# use default custom HTML files if available and none explicitly specified
if (NOT DOXYGEN_HTML_EXTRA_STYLESHEET)
if (EXISTS "${PROJECT_DOCRES_DIR}/doxygen_extra.css.in")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOCRES_DIR}/doxygen_extra.css.in")
elseif (EXISTS "${PROJECT_DOCRES_DIR}/doxygen_extra.css")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOCRES_DIR}/doxygen_extra.css")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen_extra.css.in")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOC_DIR}/doxygen_extra.css.in")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen_extra.css")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOC_DIR}/doxygen_extra.css")
elseif (EXISTS "${PROJECT_DOCRES_DIR}/doxygen.css.in")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOCRES_DIR}/doxygen.css.in")
elseif (EXISTS "${PROJECT_DOCRES_DIR}/doxygen.css")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOCRES_DIR}/doxygen.css")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen.css.in")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOC_DIR}/doxygen.css.in")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen.css")
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${PROJECT_DOC_DIR}/doxygen.css")
endif ()
endif ()
if (DOXYGEN_HTML_HEADER_IS_DEFAULT AND NOT DOXYGEN_HTML_EXTRA_STYLESHEET)
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${BASIS_MODULE_PATH}/doxygen_extra.css.in")
endif ()
if (NOT DOXYGEN_HTML_HEADER)
if (EXISTS "${PROJECT_DOCRES_DIR}/doxygen_header.html.in")
set (DOXYGEN_HTML_HEADER "${PROJECT_DOCRES_DIR}/doxygen_header.html.in")
elseif (EXISTS "${PROJECT_DOCRES_DIR}/doxygen_header.html")
set (DOXYGEN_HTML_HEADER "${PROJECT_DOCRES_DIR}/doxygen_header.html")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen_header.html.in")
set (DOXYGEN_HTML_HEADER "${PROJECT_DOC_DIR}/doxygen_header.html.in")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen_header.html")
set (DOXYGEN_HTML_HEADER "${PROJECT_DOC_DIR}/doxygen_header.html")
endif ()
endif ()
if (NOT DOXYGEN_HTML_FOOTER)
if (EXISTS "${PROJECT_DOCRES_DIR}/doxygen_footer.html.in")
set (DOXYGEN_HTML_FOOTER "${PROJECT_DOCRES_DIR}/doxygen_footer.html.in")
elseif (EXISTS "${PROJECT_DOCRES_DIR}/doxygen_footer.html")
set (DOXYGEN_HTML_FOOTER "${PROJECT_DOCRES_DIR}/doxygen_footer.html")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen_footer.html.in")
set (DOXYGEN_HTML_FOOTER "${PROJECT_DOC_DIR}/doxygen_footer.html.in")
elseif (EXISTS "${PROJECT_DOC_DIR}/doxygen_footer.html")
set (DOXYGEN_HTML_FOOTER "${PROJECT_DOC_DIR}/doxygen_footer.html")
endif ()
endif ()
# configure/copy custom HTML ressource files
if (DOXYGEN_GENERATE_HTML)
set (DOXYGEN_HTML_EXTRA_STYLESHEET_NAME "doxygen_extra.css")
set (OUTPUT_HTML_EXTRA_STYLESHEET "${DOXYGEN_OUTPUT_DIRECTORY}/${DOXYGEN_HTML_EXTRA_STYLESHEET_NAME}")
set (OUTPUT_HTML_HEADER "${DOXYGEN_OUTPUT_DIRECTORY}/doxygen_header.html")
set (OUTPUT_HTML_FOOTER "${DOXYGEN_OUTPUT_DIRECTORY}/doxygen_footer.html")
foreach (res IN ITEMS EXTRA_STYLESHEET HEADER FOOTER)
if (EXISTS "${DOXYGEN_HTML_${res}}")
if (DOXYGEN_HTML_${res} MATCHES "\\.in$")
configure_file (${DOXYGEN_HTML_${res}} "${OUTPUT_HTML_${res}}" @ONLY)
elseif (DOXYGEN_HTML_${res})
configure_file (${DOXYGEN_HTML_${res}} "${OUTPUT_HTML_${res}}" COPYONLY)
else ()
set (OUTPUT_HTML_${res})
endif ()
endif ()
endforeach ()
set (DOXYGEN_HTML_EXTRA_STYLESHEET "${OUTPUT_HTML_EXTRA_STYLESHEET}")
set (DOXYGEN_HTML_HEADER "${OUTPUT_HTML_HEADER}")
set (DOXYGEN_HTML_FOOTER "${OUTPUT_HTML_FOOTER}")
else ()
set (DOXYGEN_HTML_EXTRA_STYLESHEET)
set (DOXYGEN_HTML_FOOTER)
set (DOXYGEN_HTML_HEADER)
endif ()
if (DOXYGEN_PROVIDER_LOGO)
list (APPEND DOXYGEN_HTML_EXTRA_FILES "${DOXYGEN_PROVIDER_LOGO}")
endif()
if (DOXYGEN_DIVISION_LOGO)
list (APPEND DOXYGEN_HTML_EXTRA_FILES "${DOXYGEN_DIVISION_LOGO}")
endif()
if (DOXYGEN_HTML_EXTRA_FILES)
basis_list_to_delimited_string (
DOXYGEN_HTML_EXTRA_FILES "\"\nHTML_EXTRA_FILES += \"" ${DOXYGEN_HTML_EXTRA_FILES}
)
endif ()
# list of enabled Doxygen comment sections
basis_join ("${DOXYGEN_ENABLED_SECTIONS}" " " DOXYGEN_ENABLED_SECTIONS)
# configure Doxygen configuration file
set (DOXYFILE "${DOXYGEN_OUTPUT_DIRECTORY}/Doxyfile.${TARGET_NAME_L}")
configure_file ("${DOXYGEN_DOXYFILE}" "${DOXYFILE}" @ONLY)
# add build target
set (OPTALL)
if (BUILD_DOCUMENTATION AND BASIS_ALL_DOC)
set (OPTALL "ALL")
endif ()
file (MAKE_DIRECTORY "${DOXYGEN_OUTPUT_DIRECTORY}")
add_custom_target (
${TARGET_UID} ${OPTALL} "${DOXYGEN_EXECUTABLE}" "${DOXYFILE}"
WORKING_DIRECTORY "${DOXYGEN_OUTPUT_DIRECTORY}"
COMMENT "Building documentation ${TARGET_UID}..."
)
# memorize certain settings which might be useful to know by other functions
# in particular, in case of the use of the XML output by other documentation
# build tools such as Sphinx, the function that wants to make use of this
# output can check if the Doxygen target has been configured properly and
# further requires to know the location of the XML output
set_target_properties (
${TARGET_UID}
PROPERTIES
BASIS_TYPE Doxygen
OUTPUT_DIRECTORY "${DOXYGEN_OUTPUT_DIRECTORY}"
DOXYFILE "${DOXYGEN_DOXYFILE}"
TAGFILE "${DOXYGEN_TAGFILE}"
OUTPUT "${DOXYGEN_OUTPUT}"
)
foreach (f IN LISTS DOXYGEN_OUTPUT)
string (TOUPPER "${f}" F)
set_target_properties (
${TARGET_UID}
PROPERTIES
${F}_INSTALL_DIRECTORY "${DOXYGEN_${F}_DESTINATION}"
${F}_OUTPUT_DIRECTORY "${DOXYGEN_OUTPUT_DIRECTORY}/${DOXYGEN_${F}_OUTPUT}"
)
set_property (
DIRECTORY
APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
"${DOXYGEN_OUTPUT_DIRECTORY}/${DOXYGEN_${F}_OUTPUT}"
)
endforeach ()
if (DOXYGEN_TAGFILE)
set_property (
DIRECTORY
APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
"${DOXYGEN_TAGFILE}"
)
endif ()
# The Doxygen filter, if a build target of this project, has to be build
# before the documentation can be generated.
if (TARGET "${DOXYFILTER}")
add_dependencies (${TARGET_UID} ${DOXYFILTER})
endif ()
# The public header files shall be configured/copied before.
if (TARGET headers)
add_dependencies (${TARGET_UID} headers)
endif ()
# The documentation shall be build after all other executable and library
# targets have been build. For example, a .py.in script file shall first
# be "build", i.e., configured before the documentation is being generated
# from the configured .py file.
basis_get_project_property (TARGETS PROPERTY TARGETS)
foreach (_UID ${TARGETS})
get_target_property (BASIS_TYPE ${_UID} "BASIS_TYPE")
if (BASIS_TYPE MATCHES "SCRIPT|EXECUTABLE|LIBRARY")
add_dependencies (${TARGET_UID} ${_UID})
endif ()
endforeach ()
# add general "doc" target
if (NOT DOXYGEN_EXCLUDE_FROM_DOC)
if (NOT TARGET doc)
add_custom_target (doc)
endif ()
add_dependencies (doc ${TARGET_UID})
endif ()
# install documentation
install (
CODE
"
set (HTML_DESTINATION \"${DOXYGEN_HTML_DESTINATION}\")
set (MAN_DESTINATION \"${DOXYGEN_MAN_DESTINATION}\")
function (install_doxydoc FMT)
string (TOUPPER \"\${FMT}\" FMT_U)
set (CMAKE_INSTALL_PREFIX \"\${\${FMT_U}_DESTINATION}\")
if (NOT CMAKE_INSTALL_PREFIX)
return ()
elseif (NOT IS_ABSOLUTE \"\${CMAKE_INSTALL_PREFIX}\")
set (CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}/\${CMAKE_INSTALL_PREFIX}\")
endif ()
set (EXT)
set (DIR \"\${FMT}\")
if (FMT MATCHES \".pdf\")
set (EXT \".pdf\")
set (DIR \"latex\")
elseif (FMT MATCHES \".rtf\")
set (EXT \".rtf\")
elseif (FMT MATCHES \"man\")
set (EXT \".?\")
endif ()
file (
GLOB_RECURSE
FILES
RELATIVE \"${DOXYGEN_OUTPUT_DIRECTORY}/\${DIR}\"
\"${DOXYGEN_OUTPUT_DIRECTORY}/\${DIR}/*\${EXT}\"
)
foreach (F IN LISTS FILES)
execute_process (
COMMAND \"${CMAKE_COMMAND}\" -E compare_files
\"${DOXYGEN_OUTPUT_DIRECTORY}/\${DIR}/\${F}\"
\"\${CMAKE_INSTALL_PREFIX}/\${F}\"
RESULT_VARIABLE RC
OUTPUT_QUIET
ERROR_QUIET
)
if (RC EQUAL 0)
message (STATUS \"Up-to-date: \${CMAKE_INSTALL_PREFIX}/\${F}\")
else ()
message (STATUS \"Installing: \${CMAKE_INSTALL_PREFIX}/\${F}\")
execute_process (
COMMAND \"${CMAKE_COMMAND}\" -E copy_if_different
\"${DOXYGEN_OUTPUT_DIRECTORY}/\${DIR}/\${F}\"
\"\${CMAKE_INSTALL_PREFIX}/\${F}\"
RESULT_VARIABLE RC
OUTPUT_QUIET
ERROR_QUIET
)
if (RC EQUAL 0)
list (APPEND CMAKE_INSTALL_MANIFEST_FILES \"\${CMAKE_INSTALL_PREFIX}/\${F}\")
else ()
message (STATUS \"Failed to install \${CMAKE_INSTALL_PREFIX}/\${F}\")
endif ()
endif ()
endforeach ()
if (FMT MATCHES \"html\" AND EXISTS \"${DOXYGEN_TAGFILE}\")
get_filename_component (DOXYGEN_TAGFILE_NAME \"${DOXYGEN_TAGFILE}\" NAME)
execute_process (
COMMAND \"${CMAKE_COMMAND}\" -E copy_if_different
\"${DOXYGEN_TAGFILE}\"
\"\${CMAKE_INSTALL_PREFIX}/\${DOXYGEN_TAGFILE_NAME}\"
)
list (APPEND CMAKE_INSTALL_MANIFEST_FILES \"\${CMAKE_INSTALL_PREFIX}/\${DOXYGEN_TAGFILE_NAME}\")
endif ()
endfunction ()
foreach (FMT IN ITEMS html pdf rtf man)
install_doxydoc (\${FMT})
endforeach ()
"
)
# done
message (STATUS "Adding documentation ${TARGET_UID}... - done")
endfunction ()
# ----------------------------------------------------------------------------
## @brief Add documentation target to be generated by Sphinx (sphinx-build).
#
# This function adds a build target to generate documentation from
# <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
# (.rst files) using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
#
# @param [in] TARGET_NAME Name of the documentation target.
# @param [in] ARGN List of arguments. The valid arguments are:
# @par
# <table border="0">
# <tr>
# @tp @b EXCLUDE_FROM_DOC @endtp