~midori/midori/cmake-make-dist

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Tarmac
  • Author(s): Paweł Forysiuk, Christian Dywan
  • Date: 2013-11-05 18:00:59 UTC
  • mfrom: (6448.1.33 less-warnings)
  • Revision ID: tarmac-20131105180059-dypdrl07lyejesr3
Resolve compiler warnings in current trunk

Add EXTRA_WARNINGS flag to increase verbosity
Respect VALAC for the Vala compiler if defined
Sort out Vala 0.16 build issues
Make warnings fatal for bzr builds

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
                OUTPUT_STRIP_TRAILING_WHITESPACE)
29
29
if (REVISION)
30
30
    set(VERSION "${VERSION}~r${REVISION}")
 
31
    # All warnings are errors in development builds
 
32
    set(VALAFLAGS ${VALAFLAGS} --fatal-warnings)
 
33
    set(CFLAGS "${CFLAGS}")
31
34
endif ()
32
35
add_definitions("-DPACKAGE_VERSION=\"${VERSION}\"")
33
36
 
35
38
# Disallow building during install to avoid permission problems
36
39
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
37
40
 
 
41
find_package(Vala REQUIRED)
 
42
vala_require("0.16.0")
 
43
set(VALAFLAGS ${VALAFLAGS}
 
44
    --enable-deprecated
 
45
    --debug
 
46
    )
 
47
 
38
48
include(GNUInstallDirs)
39
49
set(DATADIR ${CMAKE_INSTALL_FULL_DATADIR})
40
50
add_definitions("-DMDATADIR=\"${DATADIR}\"")
120
130
    add_definitions("-DHAVE_LIBSOUP_2_37_1")
121
131
endif ()
122
132
if (${DEPS_libsoup-gnome-2.4_VERSION} VERSION_GREATER "2.40.0")
123
 
    add_definitions("-DHAVE_LIBSOUP_2_40_0")
124
 
    set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_40_0)
 
133
    # valac 0.16 didn't have the bindings yet
 
134
    # For consistency we need to ensure C code makes the same assumptions
 
135
    if (${VALA_VERSION} VERSION_GREATER "0.17.0")
 
136
        add_definitions("-DHAVE_LIBSOUP_2_40_0")
 
137
        set(VALAFLAGS ${VALAFLAGS} -D HAVE_LIBSOUP_2_40_0)
 
138
    endif ()
125
139
endif ()
126
140
 
127
141
if (WIN32)
140
154
option(USE_ZEITGEIST "Zeitgeist history integration" ON)
141
155
option(USE_GRANITE "Fancy notebook and pop-overs" OFF)
142
156
option(USE_APIDOCS "API documentation" OFF)
 
157
option(EXTRA_WARNINGS "Additional compiler warnings" OFF)
143
158
 
144
159
# GTK+3 is implied here, whether set or not
145
160
if (USE_GRANITE OR HALF_BRO_INCOM_WEBKIT2)
218
233
    set(EXTRA_VAPIS ${EXTRA_VAPIS} "${CMAKE_SOURCE_DIR}/midori/webkitgtk-3.0.vapi")
219
234
endif ()
220
235
 
221
 
find_package(Vala REQUIRED)
222
 
vala_require("0.16.0")
223
 
set(VALAFLAGS ${VALAFLAGS}
224
 
    --enable-deprecated
225
 
    --debug
226
 
    )
227
 
 
228
236
# dh_translations detects this if there's no variable used
229
237
set (GETTEXT_PACKAGE "midori")
230
238
add_definitions("-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\"")
231
239
 
232
 
set(CFLAGS "-Wall -Wundef -Wno-deprecated-declarations -g")
 
240
set(CFLAGS "${CFLAGS} -Wall -Wundef -Wno-deprecated-declarations -g")
 
241
 
 
242
if (EXTRA_WARNINGS)
 
243
    LIST(APPEND EXTRA_CFLAGS_LIST
 
244
        -Wextra
 
245
        -Wno-unused-parameter
 
246
        -Wno-missing-field-initializers
 
247
        -Wno-comment
 
248
        -Waggregate-return
 
249
        -Wredundant-decls
 
250
        -Wshadow -Wpointer-arith -Wcast-align
 
251
        -Winline -Wformat-security -fno-common
 
252
        -Winit-self -Wundef
 
253
        -Wnested-externs
 
254
    )
 
255
    string(REPLACE ";" " " EXTRA_CFLAGS "${EXTRA_CFLAGS_LIST}")
 
256
    set(CFLAGS "${CFLAGS} ${EXTRA_CFLAGS}")
 
257
else ()
 
258
    if (REVISION)
 
259
        set(CFLAGS "${CFLAGS} -Werror")
 
260
    endif()
 
261
endif ()
 
262
 
233
263
set(VALA_CFLAGS "-w -g")
234
264
set(LIBMIDORI "${CMAKE_PROJECT_NAME}-core")
235
265