comparison CMakeLists.txt @ 0:1158cffe5a5e

Initial import
author David Demelier <markand@malikania.fr>
date Mon, 08 Feb 2016 16:43:14 +0100
parents
children f113796cfbf9
comparison
equal deleted inserted replaced
-1:000000000000 0:1158cffe5a5e
1 #
2 # CMakeLists.txt -- CMake build system for irccd
3 #
4 # Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
5 #
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
9 #
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #
18
19 #
20 # Where to start
21 # ---------------------------------------------------------
22 #
23 # If you plan to modify the build system there are several places to look to do what you want.
24 #
25 # cmake/IrccdOptions.cmake - User definable options.
26 # cmake/IrccdPackage.cmake - Package creation.
27 # cmake/IrccdSystem.cmake - Contains some platforms checks and compile flags.
28 # cmake/IrccdVersion.cmake - Defines the Irccd version and its plugins.
29 # cmake/check - Platform checks in separate files.
30 # cmake/function - Custom functions.
31 # cmake/installer - Some files for the QtIFW installer.
32 # cmake/internal - Some internal files (e.g. the irccd-config.h)
33 # cmake/packages - Additional find_package modules.
34 #
35 # Build system is then processed in different directories:
36 #
37 # common - Static common library between irccd and irccdctl.
38 # contrib - User contributions not maintained by irccd authors.
39 # doc - The documentation process.
40 # extern - External libraries.
41 # irccd - The main irccd executable.
42 # irccdctl - The irccdctl utility.
43 # plugins - Official irccd plugins.
44 # tests - The unit tests.
45 # win32 - Additional files for Windows platform.
46 #
47
48 cmake_minimum_required(VERSION 3.0)
49 project(irccd)
50
51 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${irccd_SOURCE_DIR}/cmake/packages)
52
53 include(CMakeParseArguments)
54
55 include(cmake/function/IrccdDefineExecutable.cmake)
56 include(cmake/function/IrccdDefineHtml.cmake)
57 include(cmake/function/IrccdDefineLibrary.cmake)
58 include(cmake/function/IrccdDefineMan.cmake)
59 include(cmake/function/IrccdDefinePlugin.cmake)
60 include(cmake/function/IrccdDefineTest.cmake)
61
62 include(cmake/check/PutTime.cmake)
63
64 include(cmake/IrccdVersion.cmake)
65 include(cmake/IrccdOptions.cmake)
66 include(cmake/IrccdSystem.cmake)
67
68 add_subdirectory(extern/libircclient)
69 add_subdirectory(extern/jansson)
70 add_subdirectory(common)
71 add_subdirectory(doc)
72 add_subdirectory(irccd)
73 add_subdirectory(irccdctl)
74 add_subdirectory(contrib)
75 add_subdirectory(plugins)
76
77 # Platform specific.
78 if (WIN32)
79 add_subdirectory(win32)
80 endif ()
81
82 # Tests.
83 include(CTest)
84 add_subdirectory(tests)
85
86 message("Compiling with the following flags:")
87 message(" General flags: ${CMAKE_CXX_FLAGS}")
88 message(" Debug flags: ${CMAKE_CXX_FLAGS_DEBUG}")
89 message(" Release flags: ${CMAKE_CXX_FLAGS_RELEASE}")
90 message("")
91
92 message("Compiling irccd with following options:")
93 message(" OpenSSL: ${WITH_SSL_MSG}")
94 message(" JS: ${WITH_JS_MSG}")
95 message(" Tests: ${WITH_TESTS_MSG}")
96 message(" User docs: ${WITH_HTML_MSG}")
97 message(" Doxygen: ${WITH_DOXYGEN_MSG}")
98 message(" Package: ${IRCCD_PACKAGE_MSG}")
99 message("")
100
101 message("Installing plugins:")
102 foreach (plugin ${IRCCD_PLUGINS})
103 string(TOUPPER ${plugin} name)
104 string(LENGTH ${plugin} length)
105 set(str " ${plugin}:")
106
107 #
108 # Build a string to indent the output correctly because tabs do not work well in all windows
109 # (e.g. CMake's GUI, QtCreator...)
110 #
111 while (${length} LESS 17)
112 math(EXPR length "${length} + 1")
113 set(str "${str} ")
114 endwhile ()
115
116 message("${str}${WITH_PLUGIN_${name}_MSG}")
117 endforeach ()
118
119 message("")
120
121 # CPack (only for package_source, package_ifw is home made).
122 include(cmake/IrccdPackage.cmake)
123 include(CPack)
124
125 # Meta release target.
126 if (IRCCD_PACKAGE)
127 add_custom_target(
128 release
129 COMMENT "Releasing irccd ${IRCCD_VERSION}"
130 COMMAND
131 ${CMAKE_MAKE_PROGRAM} package_source
132 )
133
134 add_dependencies(release package_ifw)
135 endif ()
136
137 # Show warnings about non-relocatable irccd.
138 if (NOT IRCCD_RELOCATABLE)
139 message("Note: irccd is not relocatable, the following paths are absolute:")
140 message("")
141
142 foreach (path ${IRCCD_ABSOLUTE_PATHS})
143 message(" ${path} is set to ${${path}}")
144 endforeach ()
145
146 message("")
147 message("You can still use irccd, but you won't be able to move the application to a")
148 message("different directory.")
149 message("")
150 message("This may be an issue with some packages manager which allows relocating")
151 message("application in different directories.")
152 message("")
153 message("Set to relative paths if this is a concern.")
154 message("")
155 endif ()