1 | # This file is the source for generating the Makefile for the project, using cmake tool (cmake.org) |
---|
2 | |
---|
3 | # Name of the project |
---|
4 | PROJECT("freeDiameter") |
---|
5 | |
---|
6 | # Informations to display in daemon's help |
---|
7 | SET(FD_PROJECT_NAME freeDiameter) |
---|
8 | SET(FD_PROJECT_BINARY freeDiameterd) |
---|
9 | SET(FD_PROJECT_COPYRIGHT "Copyright (c) 2008-2015, WIDE Project (www.wide.ad.jp) and NICT (www.nict.go.jp)") |
---|
10 | |
---|
11 | # Version of the source code |
---|
12 | SET(FD_PROJECT_VERSION_MAJOR 1) |
---|
13 | SET(FD_PROJECT_VERSION_MINOR 5) |
---|
14 | SET(FD_PROJECT_VERSION_REV 0) |
---|
15 | |
---|
16 | # Version of the API with the library |
---|
17 | SET(FD_PROJECT_VERSION_API 6) |
---|
18 | |
---|
19 | # The test framework, using CTest and CDash. |
---|
20 | INCLUDE(CTest) |
---|
21 | |
---|
22 | # CMake version |
---|
23 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
---|
24 | |
---|
25 | # Location of additional CMake modules |
---|
26 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") |
---|
27 | |
---|
28 | # The default directories |
---|
29 | SET(DEFAULT_CONF_PATH ${CMAKE_INSTALL_PREFIX}/etc/freeDiameter CACHE PATH "Default location of freeDiameter configuration files") |
---|
30 | |
---|
31 | IF (NOT DEFINED LIB_INSTALL_DIR) |
---|
32 | SET(LIB_INSTALL_DIR lib CACHE PATH "Default library path name on the system, to accomodate RPM-based systems that use lib64") |
---|
33 | ENDIF (NOT DEFINED LIB_INSTALL_DIR) |
---|
34 | |
---|
35 | SET(INSTALL_HEADERS_SUFFIX include/freeDiameter CACHE PATH "Directory where the headers are installed (relative to CMAKE_INSTALL_PREFIX).") |
---|
36 | SET(INSTALL_DAEMON_SUFFIX bin CACHE PATH "Directory where the daemon binary is installed (relative to CMAKE_INSTALL_PREFIX).") |
---|
37 | SET(INSTALL_LIBRARY_SUFFIX ${LIB_INSTALL_DIR} CACHE PATH "Directory where the freeDiameter libraries are installed (relative to CMAKE_INSTALL_PREFIX).") |
---|
38 | SET(INSTALL_EXTENSIONS_SUFFIX ${LIB_INSTALL_DIR}/freeDiameter CACHE PATH "Directory where the extensions are installed / searched (relative to CMAKE_INSTALL_PREFIX).") |
---|
39 | |
---|
40 | # All source code should be POSIX 200112L compatible, but some other extensions might be used, so: |
---|
41 | ADD_DEFINITIONS(-D_GNU_SOURCE) |
---|
42 | |
---|
43 | # Set a default build type if none was specified |
---|
44 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
---|
45 | message(STATUS "Setting build type to 'Debug' as none was specified.") |
---|
46 | set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) |
---|
47 | # Set the possible values of build type for cmake-gui |
---|
48 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" |
---|
49 | "MinSizeRel" "RelWithDebInfo" "Profiling" "MaxPerformance" "DebianPackage" "DebugValgrind") |
---|
50 | endif() |
---|
51 | |
---|
52 | # Add a "Profiling" build type |
---|
53 | # SET(CMAKE_BUILD_TYPE Profiling) |
---|
54 | SET(CMAKE_C_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage -fstack-protector -g -Wall") |
---|
55 | |
---|
56 | # Add a "MaxPerformance" build type -- this is very silent... |
---|
57 | # SET(CMAKE_BUILD_TYPE MaxPerformance) |
---|
58 | SET(CMAKE_C_FLAGS_MAXPERFORMANCE "${CMAKE_C_FLAGS_RELEASE} -DSTRIP_DEBUG_CODE") |
---|
59 | |
---|
60 | # Add a "DebianPackage" build type used when creating the Debian packages |
---|
61 | SET(CMAKE_C_FLAGS_DEBIANPACKAGE "${CMAKE_C_FLAGS_RELWITHDEBINFO}") |
---|
62 | |
---|
63 | # Set the "Debug" flags |
---|
64 | SET(CMAKE_C_FLAGS_DEBUG "-Wall -g -O0") |
---|
65 | |
---|
66 | # Add a "DebugValgrind" build type used for checking execution with Valgrind tool |
---|
67 | SET(CMAKE_C_FLAGS_DEBUGVALGRIND "-Wall -g -O0") |
---|
68 | |
---|
69 | # Set the DEBUG flag for Debug and Profiling builds |
---|
70 | IF (CMAKE_BUILD_TYPE MATCHES "Debug|Profiling|DebugValgrind") |
---|
71 | SET(DEBUG 1) |
---|
72 | ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug|Profiling|DebugValgrind") |
---|
73 | |
---|
74 | # Build with fatal warnings? |
---|
75 | IF (ERRORS_ON_WARNINGS) |
---|
76 | SET(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") |
---|
77 | SET(CMAKE_REQUIRED_FLAGS "-Wno-error ${CMAKE_REQUIRED_FLAGS}") |
---|
78 | ENDIF (ERRORS_ON_WARNINGS) |
---|
79 | |
---|
80 | # some subfolders use yacc and lex parsers |
---|
81 | SET(BISON_GENERATE_DEFINES TRUE) |
---|
82 | SET(BISON_PREFIX_OUTPUTS TRUE) |
---|
83 | INCLUDE(CMakeUserUseBison) |
---|
84 | SET(FLEX_PREFIX_OUTPUTS TRUE) |
---|
85 | INCLUDE(CMakeUserUseFlex) |
---|
86 | IF( NOT BISON_EXECUTABLE OR NOT FLEX_EXECUTABLE ) |
---|
87 | MESSAGE( SEND_ERROR "Bison and Flex are required" ) |
---|
88 | ENDIF( NOT BISON_EXECUTABLE OR NOT FLEX_EXECUTABLE ) |
---|
89 | # Check that flex is at least 2.5.20 to support bison-bridge |
---|
90 | # how to do the check with cmake??? |
---|
91 | |
---|
92 | # Add this to workaround an apparent bug in FreeBSD cmake (already defined in Linux) |
---|
93 | SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic") |
---|
94 | |
---|
95 | # For Darwin systems |
---|
96 | IF(APPLE) |
---|
97 | SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined dynamic_lookup") |
---|
98 | SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -flat_namespace -undefined dynamic_lookup") |
---|
99 | ENDIF(APPLE) |
---|
100 | |
---|
101 | # Location for the include files |
---|
102 | INCLUDE_DIRECTORIES(include) |
---|
103 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include) |
---|
104 | SUBDIRS(include/freeDiameter) |
---|
105 | |
---|
106 | # Location for the source code |
---|
107 | SUBDIRS(libfdproto) |
---|
108 | SUBDIRS(libfdcore) |
---|
109 | SUBDIRS(freeDiameterd) |
---|
110 | |
---|
111 | # Extensions (there is no use of freeDiameter without any extension) |
---|
112 | SUBDIRS(extensions) |
---|
113 | |
---|
114 | # The unary tests directory |
---|
115 | IF ( BUILD_TESTING ) |
---|
116 | SUBDIRS(tests) |
---|
117 | ENDIF ( BUILD_TESTING ) |
---|