~phablet-team/messaging-framework/last-minute-fixes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
project(messaging-framework C CXX)
cmake_minimum_required(VERSION 2.8.10)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# Select a pedantic set of compiler flags and enable C++11 support.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-deprecated-register -Wno-extra-semi -Wno-gnu-zero-variadic-macro-arguments -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -Wextra -Wno-deprecated-register -Wno-extra-semi -Wno-gnu-zero-variadic-macro-arguments")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Include the entire CTest functionality, specifically for MakeNightlyMemCheck.
include(CTest)
include(GNUInstallDirs)

find_package(Boost COMPONENTS filesystem program_options system REQUIRED)
find_package(GLog)
find_package(PkgConfig)
find_package(Qt5Core REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(Qt5Test REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Threads)
find_package(LibPhoneNumber REQUIRED)
pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
pkg_check_modules(TP_QT5 REQUIRED TelepathyQt5)

# Enable handy automoc functionality.
add_definitions(-DQT_NO_KEYWORDS)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

set(SO_VERSION_MAJOR "1")
set(SO_VERSION_MINOR "1")
set(SO_VERSION_PATCH "0")
set(SO_VERSION "${SO_VERSION_MAJOR}.${SO_VERSION_MINOR}.${SO_VERSION_PATCH}")

option(CLICK_MODE "Installs to a contained location" on)

#
# Code style fixer. We put the code through astyle first because it makes some fixes that
# clang-format won't do (such as "char *p" -> "char* p"). But astyle messes up other things
# (particularly lambdas and assembly-style comments), which clang-format does right.
# So, we run clang-format after running astyle, which undoes the damage done by astyle
# without reverting desirable astyle fixes.
#

find_program(ASTYLE_COMMAND NAMES astyle)
if (NOT ASTYLE_COMMAND)
    message(WARNING "Cannot find astyle: formatcode target will not be available")
else()
    # astyle 2.03 creates DOS line endings, so we need to fix its output
    find_program(DOS2UNIX_COMMAND NAMES dos2unix)
    if (NOT DOS2UNIX_COMMAND)
        message(WARNING "Cannot find dos2unix: formatcode target will not be available")
    else()
        find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.6 clang-format-3.5)
        if (NOT CLANG_FORMAT_COMMAND)
            message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available")
        endif()
    endif()
endif()

if (ASTYLE_COMMAND AND DOS2UNIX_COMMAND AND CLANG_FORMAT_COMMAND)
add_subdirectory(scripts)
add_custom_target(
  format

  COMMAND ${CMAKE_BINARY_DIR}/scripts/formatcode ${CMAKE_SOURCE_DIR}/include ${ASTYLE_COMMAND} ${CLANG_FORMAT_COMMAND}
  COMMAND ${CMAKE_BINARY_DIR}/scripts/formatcode ${CMAKE_SOURCE_DIR}/src ${ASTYLE_COMMAND} ${CLANG_FORMAT_COMMAND}
  COMMAND ${CMAKE_BINARY_DIR}/scripts/formatcode ${CMAKE_SOURCE_DIR}/tests ${ASTYLE_COMMAND} ${CLANG_FORMAT_COMMAND}
  )
endif()

include_directories(
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_SOURCE_DIR}/include
  ${Boost_INCLUDE_DIRS}
  ${GLog_INCLUDE_DIR}
  ${TP_QT5_INCLUDE_DIRS}
)

add_subdirectory(data)
add_subdirectory(doc)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(tests)