Imported Upstream version 1.8.12
[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 option(force_qt4       "Forces doxywizard to build using Qt4 even if Qt5 is installed" OFF)
27
28 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
29 set(TOP "${CMAKE_SOURCE_DIR}")
30 include(version)
31
32 set(sqlite3  "0" CACHE INTERNAL "used in settings.h")
33 set(clang    "0" CACHE INTERNAL "used in settings.h")
34 if (use_sqlite3)
35         set(sqlite3  "1" CACHE INTERNAL "used in settings.h")
36 endif()
37 if (use_libclang)
38         set(clang    "1" CACHE INTERNAL "used in settings.h")
39         find_package(LibClang REQUIRED)
40 endif()
41
42 if (${CMAKE_SYSTEM} MATCHES "Darwin")
43     set(CMAKE_CXX_FLAGS "-Wno-deprecated-register -mmacosx-version-min=10.5 ${CMAKE_CXX_FLAGS}")
44     set(CMAKE_C_FLAGS "-Wno-deprecated-register -mmacosx-version-min=10.5 ${CMAKE_C_FLAGS}")
45     find_library(CORESERVICES_LIB CoreServices)
46     set(EXTRA_LIBS ${CORESERVICES_LIB})
47 endif()
48
49 if (WIN32)
50     if(NOT ICONV_DIR)
51       set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild")
52     endif()
53     set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC")
54     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # needed for language.cpp on 64bit
55     add_definitions(-DLIBICONV_STATIC -D_CRT_SECURE_NO_WARNINGS)
56 endif()
57
58 if ("${CMAKE_GENERATOR}" MATCHES "Ninja") 
59   set(LEX_FLAGS )
60   set(YACC_FLAGS )
61 else ("${CMAKE_GENERATOR}" MATCHES "Ninja") 
62   set(LEX_FLAGS $(LEX_FLAGS))
63   set(YACC_FLAGS $(YACC_FLAGS))
64 endif ("${CMAKE_GENERATOR}" MATCHES "Ninja") 
65
66 find_program(DOT NAMES dot)
67 find_package(PythonInterp REQUIRED)
68 find_package(FLEX REQUIRED)
69 find_package(BISON REQUIRED)
70 find_package(Threads)
71
72 if (sqlite3)
73     find_package(SQLite3 REQUIRED)
74 endif()
75
76 find_package(Iconv REQUIRED)
77 include_directories(${ICONV_INCLUDE_DIR})
78
79
80 #set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs")
81 set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc)
82 set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS})
83 set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files")
84 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
85 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
86 set(CUSTOM_INCLUDE_DIR "" CACHE FILEPATH "Extra include path")
87 set(CUSTOM_LINK_DIR "" CACHE FILEPATH "Extra library path")
88
89 # place binaries for all build types in the same directory, so we know where to find it
90 # when running tests or generating docs
91 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
92 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
93 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${EXECUTABLE_OUTPUT_PATH})
94 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH})
95
96 # gather lang codes for translation
97 file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h")
98 set(lcodes "")
99 foreach (_lang ${lang_files})
100   string(REGEX REPLACE "translator_(.*).h" "\\1" _lang_code ${_lang})
101   string(TOUPPER ${_lang_code} lang_code)
102   list(APPEND lcodes "${lang_code}")
103 endforeach()
104 if (english_only) # user only wants English
105   set(lcodes "ENONLY")
106 endif()
107 set(LANG_CODES ${lcodes} CACHE STRING "List of language codes for which translations should be compiled in")
108
109 if (${CUSTOM_INCLUDE_DIR})
110    include_directories(${CUSTOM_INCLUDE_DIR})
111 endif()
112
113 if (${CUSTOM_LINK_DIR})
114    link_directories(${CUSTOM_LINK_DIR})
115 endif()
116
117 if (win_static)
118     set(CompilerFlags
119         CMAKE_CXX_FLAGS
120         CMAKE_CXX_FLAGS_DEBUG
121         CMAKE_CXX_FLAGS_RELEASE
122         CMAKE_CXX_FLAGS_MINSIZEREL
123         CMAKE_CXX_FLAGS_RELWITHDEBINFO
124         CMAKE_C_FLAGS
125         CMAKE_C_FLAGS_DEBUG
126         CMAKE_C_FLAGS_RELEASE
127         CMAKE_C_FLAGS_MINSIZEREL
128         CMAKE_C_FLAGS_RELWITHDEBINFO)
129     foreach(CompilerFlag ${CompilerFlags})
130       string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
131     endforeach()
132 endif()
133
134
135 add_subdirectory(libmd5)
136 add_subdirectory(qtools)
137 add_subdirectory(vhdlparser)
138 add_subdirectory(src)
139 add_subdirectory(examples)
140 add_subdirectory(doc)
141
142 add_subdirectory(addon/doxmlparser)
143 add_subdirectory(addon/doxyapp)
144 add_subdirectory(addon/doxysearch)
145 add_subdirectory(addon/doxywizard)
146
147 enable_testing()
148 add_subdirectory(testing)
149
150 include(cmake/packaging.cmake) # set CPACK_xxxx properties
151 include(CPack)