Imported Upstream version 1.8.10
[platform/upstream/doxygen.git] / CMakeLists.txt
1 # vim:ts=4:sw=4:expandtab:autoindent:
2 #
3 # Copyright (C) 1997-2015 by Dimitri van Heesch.
4 #
5 # Permission to use, copy, modify, and distribute this software and its
6 # documentation under the terms of the GNU General Public License is hereby
7 # granted. No representations are made about the suitability of this software
8 # for any purpose. It is provided "as is" without express or implied warranty.
9 # See the GNU General Public License for more details.
10 #
11 # Documents produced by Doxygen are derivative works derived from the
12 # input used in their production; they are not affected by this license.
13
14 cmake_minimum_required(VERSION 2.8.12)
15 project(doxygen)
16
17 option(build_wizard    "Build the GUI frontend for doxygen." OFF)
18 option(build_app       "Example showing how to embed doxygen in an application." OFF)
19 option(build_xmlparser "Example showing how to parse doxygen's XML output." OFF)
20 option(build_search    "Build external search tools (doxysearch and doxyindexer)" OFF)
21 option(build_doc       "Build user manual" OFF)
22 option(use_sqlite3     "Add support for sqlite3 output [experimental]." OFF)
23 option(use_libclang    "Add support for libclang parsing." OFF)
24 option(win_static      "Link with /MT in stead of /MD on windows" OFF)
25 option(english_only    "Only compile in support for the English language" OFF)
26
27 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
28 set(SOURCE "${CMAKE_SOURCE_DIR}")
29 include(version)
30
31 set(sqlite3  "0" CACHE INTERNAL "used in settings.h")
32 set(clang    "0" CACHE INTERNAL "used in settings.h")
33 if (use_sqlite3)
34         set(sqlite3  "1" CACHE INTERNAL "used in settings.h")
35 endif()
36 if (use_libclang)
37         set(clang    "1" CACHE INTERNAL "used in settings.h")
38         find_package(LibClang REQUIRED)
39 endif()
40
41 if (${CMAKE_SYSTEM} MATCHES "Darwin")
42     set(CMAKE_CXX_FLAGS "-Wno-deprecated-register -mmacosx-version-min=10.5 ${CMAKE_CXX_FLAGS}")
43     find_library(CORESERVICES_LIB CoreServices)
44     set(EXTRA_LIBS ${CORESERVICES_LIB})
45 endif()
46
47 if (WIN32)
48     set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild")
49     set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC")
50     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # needed for language.cpp on 64bit
51     add_definitions(-DLIBICONV_STATIC -D_CRT_SECURE_NO_WARNINGS)
52 endif()
53
54 find_program(DOT NAMES dot)
55 find_package(PythonInterp REQUIRED)
56 find_package(FLEX REQUIRED)
57 find_package(BISON REQUIRED)
58 find_package(Threads)
59
60 if (sqlite3)
61     find_package(SQLite3 REQUIRED)
62 endif()
63
64 find_package(Iconv REQUIRED)
65 include_directories(${ICONV_INCLUDE_DIR})
66
67
68 #set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs")
69 set(DOC_INSTALL_DIR "share/doc/packages/doxygen" CACHE STRING "Relative path where to install the documentation")
70 set(EXAMPLE_DIR ${CMAKE_SOURCE_DIR}/examples)
71 set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc)
72 set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS})
73 set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files")
74 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
75 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
76 set(CUSTOM_INCLUDE_DIR "" CACHE FILEPATH "Extra include path")
77 set(CUSTOM_LINK_DIR "" CACHE FILEPATH "Extra library path")
78
79 # place binaries for all build types in the same directory, so we know where to find it
80 # when running tests or generating docs
81 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
82 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
83 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${EXECUTABLE_OUTPUT_PATH})
84 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH})
85
86 # gather lang codes for translation
87 file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h")
88 set(lcodes "")
89 foreach (_lang ${lang_files})
90   string(REGEX REPLACE "translator_(.*).h" "\\1" _lang_code ${_lang})
91   string(TOUPPER ${_lang_code} lang_code)
92   list(APPEND lcodes "${lang_code}")
93 endforeach()
94 if (english_only) # user only wants English
95   set(lcodes "ENONLY")
96 endif()
97 set(LANG_CODES ${lcodes} CACHE STRING "List of language codes for which translations should be compiled in")
98
99 if (${CUSTOM_INCLUDE_DIR})
100    include_directories(${CUSTOM_INCLUDE_DIR})
101 endif()
102
103 if (${CUSTOM_LINK_DIR})
104    link_directories(${CUSTOM_LINK_DIR})
105 endif()
106
107 if (win_static)
108     set(CompilerFlags
109         CMAKE_CXX_FLAGS
110         CMAKE_CXX_FLAGS_DEBUG
111         CMAKE_CXX_FLAGS_RELEASE
112         CMAKE_CXX_FLAGS_MINSIZEREL
113         CMAKE_CXX_FLAGS_RELWITHDEBINFO
114         CMAKE_C_FLAGS
115         CMAKE_C_FLAGS_DEBUG
116         CMAKE_C_FLAGS_RELEASE
117         CMAKE_C_FLAGS_MINSIZEREL
118         CMAKE_C_FLAGS_RELWITHDEBINFO)
119     foreach(CompilerFlag ${CompilerFlags})
120       string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
121     endforeach()
122 endif()
123
124
125 add_subdirectory(libmd5)
126 add_subdirectory(qtools)
127 add_subdirectory(vhdlparser)
128 add_subdirectory(src)
129 add_subdirectory(examples)
130 add_subdirectory(doc)
131
132 add_subdirectory(addon/doxmlparser)
133 add_subdirectory(addon/doxyapp)
134 add_subdirectory(addon/doxysearch)
135 add_subdirectory(addon/doxywizard)
136
137 enable_testing()
138 add_subdirectory(testing)