Mercurial > irccd
annotate CMakeLists.txt @ 1103:c94ae6941ce0
cmake: fix libm build
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 19 Oct 2021 11:11:20 +0200 |
parents | 5b9c21b3907a |
children | 02c1b78b9b58 |
rev | line source |
---|---|
1098
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
1 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
2 # CMakeLists.txt -- CMake build system for irccd |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
3 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
4 # Copyright (c) 2013-2021 David Demelier <markand@malikania.fr> |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
5 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
6 # Permission to use, copy, modify, and/or distribute this software for any |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
7 # purpose with or without fee is hereby granted, provided that the above |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
8 # copyright notice and this permission notice appear in all copies. |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
9 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
17 # |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
18 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
19 cmake_minimum_required(VERSION 2.20) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
20 cmake_policy(SET CMP0048 NEW) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
21 project(irccd |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
22 LANGUAGES C |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
23 DESCRIPTION "IRC Client Daemon" |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
24 HOMEPAGE_URL "http://projects.malikania.fr/irccd" |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
25 VERSION 4.0.0 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
26 ) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
27 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
28 set_property(GLOBAL PROPERTY USE_FOLDERS On) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
29 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
30 set(CMAKE_C_STANDARD 11) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
31 set(CMAKE_C_STANDARD_REQUIRED On) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
32 set(CMAKE_C_EXTENSIONS Off) |
1102
5b9c21b3907a
cmake: fix build on UNIX likes
David Demelier <markand@malikania.fr>
parents:
1098
diff
changeset
|
33 set(CMAKE_POSITION_INDEPENDENT_CODE On) |
1098
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
34 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
35 if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
36 set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic ${CMAKE_C_FLAGS}") |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
37 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
38 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
39 option(IRCCD_WITH_EXAMPLES "Enable example files" On) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
40 option(IRCCD_WITH_JS "Enable Javascript" On) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
41 option(IRCCD_WITH_MAN "Enable manual pages" On) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
42 option(IRCCD_WITH_SSL "Enable SSL (requires OpenSSL)" On) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
43 option(IRCCD_WITH_TESTS "Enable unit tests" On) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
44 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
45 include(GNUInstallDirs) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
46 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
47 include(cmake/IrccdDefinePlugin.cmake) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
48 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
49 if (IRCCD_WITH_SSL) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
50 find_package(OpenSSL REQUIRED) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
51 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
52 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
53 if (IRCCD_WITH_JS) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
54 add_subdirectory(extern/libduktape) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
55 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
56 |
1103
c94ae6941ce0
cmake: fix libm build
David Demelier <markand@malikania.fr>
parents:
1102
diff
changeset
|
57 # Check presence of POSIX m library |
c94ae6941ce0
cmake: fix libm build
David Demelier <markand@malikania.fr>
parents:
1102
diff
changeset
|
58 find_library(M_LIBRARY m libm) |
c94ae6941ce0
cmake: fix libm build
David Demelier <markand@malikania.fr>
parents:
1102
diff
changeset
|
59 |
1098
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
60 add_subdirectory(extern/libutlist) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
61 add_subdirectory(extern/libketopt) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
62 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
63 add_subdirectory(lib) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
64 add_subdirectory(irccd) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
65 add_subdirectory(irccdctl) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
66 add_subdirectory(plugins) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
67 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
68 if (IRCCD_WITH_EXAMPLES) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
69 add_subdirectory(examples) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
70 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
71 if (IRCCD_WITH_MAN) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
72 add_subdirectory(man) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
73 endif () |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
74 |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
75 if (IRCCD_WITH_TESTS) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
76 enable_testing() |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
77 add_subdirectory(extern/libgreatest) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
78 add_subdirectory(tests) |
6c15d37b7518
cmake: switch back to CMake because of portability issues
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
79 endif () |