1 # vim:ts=4:sw=4:expandtab:autoindent:
3 # Copyright (C) 1997-2015 by Dimitri van Heesch.
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.
11 # Documents produced by Doxygen are derivative works derived from the
12 # input used in their production; they are not affected by this license.
14 cmake_minimum_required(VERSION 2.8.12)
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)
28 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
29 set(TOP "${CMAKE_SOURCE_DIR}")
32 set(sqlite3 "0" CACHE INTERNAL "used in settings.h")
33 set(clang "0" CACHE INTERNAL "used in settings.h")
35 set(sqlite3 "1" CACHE INTERNAL "used in settings.h")
38 set(clang "1" CACHE INTERNAL "used in settings.h")
39 find_package(LibClang REQUIRED)
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})
51 set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild")
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)
58 find_program(DOT NAMES dot)
59 find_package(PythonInterp REQUIRED)
60 find_package(FLEX REQUIRED)
61 find_package(BISON REQUIRED)
65 find_package(SQLite3 REQUIRED)
68 find_package(Iconv REQUIRED)
69 include_directories(${ICONV_INCLUDE_DIR})
72 #set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs")
73 set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc)
74 set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS})
75 set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files")
76 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
77 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
78 set(CUSTOM_INCLUDE_DIR "" CACHE FILEPATH "Extra include path")
79 set(CUSTOM_LINK_DIR "" CACHE FILEPATH "Extra library path")
81 # place binaries for all build types in the same directory, so we know where to find it
82 # when running tests or generating docs
83 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
84 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
85 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${EXECUTABLE_OUTPUT_PATH})
86 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH})
88 # gather lang codes for translation
89 file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h")
91 foreach (_lang ${lang_files})
92 string(REGEX REPLACE "translator_(.*).h" "\\1" _lang_code ${_lang})
93 string(TOUPPER ${_lang_code} lang_code)
94 list(APPEND lcodes "${lang_code}")
96 if (english_only) # user only wants English
99 set(LANG_CODES ${lcodes} CACHE STRING "List of language codes for which translations should be compiled in")
101 if (${CUSTOM_INCLUDE_DIR})
102 include_directories(${CUSTOM_INCLUDE_DIR})
105 if (${CUSTOM_LINK_DIR})
106 link_directories(${CUSTOM_LINK_DIR})
112 CMAKE_CXX_FLAGS_DEBUG
113 CMAKE_CXX_FLAGS_RELEASE
114 CMAKE_CXX_FLAGS_MINSIZEREL
115 CMAKE_CXX_FLAGS_RELWITHDEBINFO
118 CMAKE_C_FLAGS_RELEASE
119 CMAKE_C_FLAGS_MINSIZEREL
120 CMAKE_C_FLAGS_RELWITHDEBINFO)
121 foreach(CompilerFlag ${CompilerFlags})
122 string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
127 add_subdirectory(libmd5)
128 add_subdirectory(qtools)
129 add_subdirectory(vhdlparser)
130 add_subdirectory(src)
131 add_subdirectory(examples)
132 add_subdirectory(doc)
134 add_subdirectory(addon/doxmlparser)
135 add_subdirectory(addon/doxyapp)
136 add_subdirectory(addon/doxysearch)
137 add_subdirectory(addon/doxywizard)
140 add_subdirectory(testing)
142 include(cmake/packaging.cmake) # set CPACK_xxxx properties