0027321: Configuration, CMake - check for doxygen during the first configuration...
[occt.git] / adm / cmake / doxygen.cmake
1 # doxygen
2
3 if (DO_ONLY_CHECK_FOR_DOXYGEN)
4   message (STATUS "Info. Detecting doxygen")
5   set (DOXYGEN_SKIP_DOT ON)
6   find_package (Doxygen)
7
8   set (CAN_DOXYGEN_BE_USED OFF)
9   if (DOXYGEN_EXECUTABLE)
10     set (CAN_DOXYGEN_BE_USED ON)
11     message (STATUS "Info. Doxygen is found and can be used")
12   endif()
13 else()
14   set (3RDPARTY_DOT_EXECUTABLE_DESCR       "The path to the 'dot' tool producing layered drawings of directed graphs.\nThis tool used by doxygen")
15   set (3RDPARTY_DOXYGEN_EXECUTABLE_DESCR   "The path to the doxygen command")
16
17   if (NOT DEFINED 3RDPARTY_DOXYGEN_EXECUTABLE)
18     set (3RDPARTY_DOXYGEN_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}")
19   endif()
20
21   if (NOT DEFINED 3RDPARTY_DOT_EXECUTABLE)
22     set (3RDPARTY_DOT_EXECUTABLE "" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}")
23   endif()
24
25   if (NOT DEFINED 3RDPARTY_SKIP_DOT_EXECUTABLE)
26     set (3RDPARTY_SKIP_DOT_EXECUTABLE ON CACHE BOOL "Skip trying to find Dot")
27   endif()
28
29   if (3RDPARTY_SKIP_DOT_EXECUTABLE)
30     OCCT_CHECK_AND_UNSET (3RDPARTY_DOT_EXECUTABLE)
31   endif()
32
33   if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE))
34
35     set (DOXYGEN_SKIP_DOT ${3RDPARTY_SKIP_DOT_EXECUTABLE})
36     find_package (Doxygen)
37     
38     if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE AND DOXYGEN_EXECUTABLE)
39       set (3RDPARTY_DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOXYGEN_EXECUTABLE_DESCR}" FORCE)
40     endif()
41     
42     if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE AND NOT 3RDPARTY_DOT_EXECUTABLE AND DOXYGEN_DOT_EXECUTABLE)
43       set (3RDPARTY_DOT_EXECUTABLE "${DOXYGEN_DOT_EXECUTABLE}" CACHE FILEPATH "${3RDPARTY_DOT_EXECUTABLE_DESCR}" FORCE)
44     endif()
45   endif()
46
47   if (NOT 3RDPARTY_DOXYGEN_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOXYGEN_EXECUTABLE}")
48     list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOXYGEN_EXECUTABLE)
49   endif()
50
51   if (NOT 3RDPARTY_SKIP_DOT_EXECUTABLE)
52     if (NOT 3RDPARTY_DOT_EXECUTABLE OR NOT EXISTS "${3RDPARTY_DOT_EXECUTABLE}")
53       list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DOT_EXECUTABLE)
54     endif()
55   endif()
56 endif()
57
58 # unset all redundant variables
59 OCCT_CHECK_AND_UNSET (DOXYGEN_SKIP_DOT)
60 OCCT_CHECK_AND_UNSET (DOXYGEN_EXECUTABLE)
61 OCCT_CHECK_AND_UNSET (DOXYGEN_DOT_EXECUTABLE)