annotate cmake/MalikaniaOptions.cmake @ 54:0edaba9986ba

CMake: add vera++, closes 602
author David Demelier <markand@malikania.fr>
date Fri, 16 Dec 2016 13:59:55 +0100
parents 697bf85e8e19
children fce7e41875db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
1 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
2 # CMakeLists.txt -- CMake build system for malikania
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
3 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
4 # Copyright (c) 2013-2016 Malikania Authors
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
5 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
6 # Permission to use, copy, modify, and/or distribute this software for any
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
7 # purpose with or without fee is hereby granted, provided that the above
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
8 # copyright notice and this permission notice appear in all copies.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
9 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
17 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
18
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
19 #
50
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
20 # Fakeroot directory.
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
21 # -------------------------------------------------------------------
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
22 #
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
23 # This option specifies where to build the project as it would be installed
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
24 # using the install target or installers.
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
25 #
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
26 # This helps development.
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
27 #
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
28
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
29 set(WITH_FAKEROOT_DIR "${CMAKE_BINARY_DIR}/fakeroot"
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
30 CACHE STRING "Where to build project as it would be installed")
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
31
697bf85e8e19 CMake: move executables into fakeroot/bin
David Demelier <markand@malikania.fr>
parents: 49
diff changeset
32 #
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
33 # Backend selection.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
34 # -------------------------------------------------------------------
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
35 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
36 # The following options are available:
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
37 # WITH_BACKEND - Type of backend to use. (Default: SDL)
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
38 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
39
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
40 set(WITH_BACKEND "SDL"
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
41 CACHE STRING "Which backend to use")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
42
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
43 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
44 # Documentation and technical references
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
45 # -------------------------------------------------------------------
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
46 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
47 # The following options are available:
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
48 # WITH_DOCS - Disable or enable all docs, if set to Off, disable all documentation.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
49 # WITH_DOXYGEN - Enable doxygen
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
50 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
51
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
52 option(WITH_DOCS "Build all documentation" On)
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
53 option(WITH_DOXYGEN "Enable doxygen generation" On)
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
54
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
55 if (NOT WITH_DOCS)
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
56 set(WITH_DOXYGEN Off)
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
57 endif ()
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
58
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
59 set(WITH_DRIVERDIR "lib/malikania/${MALIKANIA_VERSION}"
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
60 CACHE STRING "Database driver directory")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
61 set(WITH_BINDIR "libexec/malikania/${MALIKANIA_VERSION}"
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
62 CACHE STRING "Front end directory")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
63
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
64 if (IS_ABSOLUTE ${WITH_DRIVERDIR})
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
65 message(FATAL_ERROR "WITH_DRIVERDIR must not be absolute")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
66 elseif (IS_ABSOLUTE ${WITH_BINDIR})
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
67 message(FATAL_ERROR "WITH_BINDIR must not be absolute")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
68 endif ()
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
69
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
70 #
54
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
71 # Options for development.
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
72 # -------------------------------------------------------------------
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
73 #
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
74
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
75 option(WITH_VERA "Enable vera++ analyzer" On)
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
76
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
77 find_program(VERA_EXECUTABLE vera++)
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
78
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
79 if (VERA_EXECUTABLE)
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
80 if (WITH_VERA)
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
81 malikania_setg(WITH_VERA_MSG "Yes")
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
82 else ()
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
83 malikania_setg(WITH_MSG Off)
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
84 malikania_setg(WITH_VERA_MSG "No (vera++ not found)")
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
85 endif ()
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
86 else ()
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
87 malikania_setg(WITH_VERA_MSG "No (disabled by user)")
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
88 endif ()
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
89
0edaba9986ba CMake: add vera++, closes 602
David Demelier <markand@malikania.fr>
parents: 50
diff changeset
90 #
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
91 # Options for unit tests
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
92 # -------------------------------------------------------------------
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
93 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
94
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
95 set(WITH_TEST_PGSQL_HOST "localhost"
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
96 CACHE STRING "Hostname for PostgreSQL driver")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
97 set(WITH_TEST_PGSQL_PORT "5432"
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
98 CACHE STRING "Port for PostgreSQL driver")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
99 set(WITH_TEST_PGSQL_DATABASE "malikaniadb"
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
100 CACHE STRING "Database for PostgreSQL driver")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
101 set(WITH_TEST_PGSQL_USER "malikania"
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
102 CACHE STRING "Username for PostgreSQL driver")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
103
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
104 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
105 # Targets to build
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
106 # -------------------------------------------------------------------
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
107 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
108 # The following options are available:
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
109 # WITH_LIBCLIENT - Build the client library.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
110 # WITH_LIBSERVER - Build the server library.
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
111 #
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
112
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
113 option(WITH_LIBCLIENT "Build libclient" On)
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
114 option(WITH_LIBSERVER "Build libserver" On)
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
115
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
116 if (WITH_BACKEND MATCHES "SDL")
49
2804ae55c70f CMake: big cleanup, closes #598
David Demelier <markand@malikania.fr>
parents: 33
diff changeset
117 set(WITH_BACKEND_DIR "backend/sdl")
33
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
118 else ()
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
119 message(FATAL_ERROR "Unknown backend selected: ${WITH_BACKEND}")
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
120 endif ()
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
121
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
122 configure_file(
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
123 ${malikania_SOURCE_DIR}/cmake/internal/sysconfig-tests.h
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
124 ${malikania_BINARY_DIR}/sysconfig-tests.h
d4f5f7231b84 Misc: switch to .hpp, dos2unix everything while here, #478
David Demelier <markand@malikania.fr>
parents: 30
diff changeset
125 )