| 1 | # This file is the source for generating the Makefile for the project, using cmake tool (cmake.org) |
|---|
| 2 | |
|---|
| 3 | # Name of the project, and language |
|---|
| 4 | PROJECT("freeDiameter" C) |
|---|
| 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-2009, 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 0) |
|---|
| 14 | SET(FD_PROJECT_VERSION_REV 3) |
|---|
| 15 | |
|---|
| 16 | # Version of the API with the library |
|---|
| 17 | SET(FD_PROJECT_VERSION_API 1) |
|---|
| 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 | SET(INSTALL_HEADERS_SUFFIX include/freeDiameter CACHE PATH "Directory where the headers are installed (relative to CMAKE_INSTALL_PREFIX).") |
|---|
| 32 | SET(INSTALL_EXTENSIONS_SUFFIX lib/freeDiameter CACHE PATH "Directory where the extensions are installed / searched (relative to CMAKE_INSTALL_PREFIX).") |
|---|
| 33 | SET(INSTALL_DAEMON_SUFFIX bin CACHE PATH "Directory where the daemon binary is installed (relative to CMAKE_INSTALL_PREFIX).") |
|---|
| 34 | SET(INSTALL_LIBRARY_SUFFIX lib CACHE PATH "Directory where the libfreeDiameter library is installed (relative to CMAKE_INSTALL_PREFIX).") |
|---|
| 35 | |
|---|
| 36 | # All source code should be POSIX 200112L compatible, but some other extensions might be used, so: |
|---|
| 37 | ADD_DEFINITIONS(-D_GNU_SOURCE) |
|---|
| 38 | |
|---|
| 39 | # Add a "Profiling" build type |
|---|
| 40 | # SET(CMAKE_BUILD_TYPE Profiling) |
|---|
| 41 | SET(CMAKE_C_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage -fstack-protector -g -Wall") |
|---|
| 42 | |
|---|
| 43 | # Add a "MaxPerformance" build type -- this is very silent... |
|---|
| 44 | # SET(CMAKE_BUILD_TYPE MaxPerformance) |
|---|
| 45 | SET(CMAKE_C_FLAGS_MAXPERFORMANCE "${CMAKE_C_FLAGS_RELEASE} -DSTRIP_DEBUG_CODE") |
|---|
| 46 | |
|---|
| 47 | # Add a "DebianPackage" build type used when creating the Debian packages |
|---|
| 48 | SET(CMAKE_C_FLAGS_DEBIANPACKAGE "${CMAKE_C_FLAGS_RELWITHDEBINFO}") |
|---|
| 49 | |
|---|
| 50 | # Add a "DebugValgrind" build type used for checking execution with Valgrind tool |
|---|
| 51 | SET(CMAKE_C_FLAGS_DEBUGVALGRIND "-Wall -g -O0") |
|---|
| 52 | |
|---|
| 53 | # Set the DEBUG flag for Debug and Profiling builds |
|---|
| 54 | IF (CMAKE_BUILD_TYPE MATCHES "Debug|Profiling|DebugValgrind") |
|---|
| 55 | SET(DEBUG 1) |
|---|
| 56 | ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug|Profiling|DebugValgrind") |
|---|
| 57 | |
|---|
| 58 | # some subfolders use yacc and lex parsers |
|---|
| 59 | SET(BISON_GENERATE_DEFINES TRUE) |
|---|
| 60 | SET(BISON_PREFIX_OUTPUTS TRUE) |
|---|
| 61 | INCLUDE(CMakeUserUseBison) |
|---|
| 62 | SET(FLEX_PREFIX_OUTPUTS TRUE) |
|---|
| 63 | INCLUDE(CMakeUserUseFlex) |
|---|
| 64 | IF( NOT BISON_EXECUTABLE OR NOT FLEX_EXECUTABLE ) |
|---|
| 65 | MESSAGE( SEND_ERROR "Bison and Flex are required" ) |
|---|
| 66 | ENDIF( NOT BISON_EXECUTABLE OR NOT FLEX_EXECUTABLE ) |
|---|
| 67 | # Check that flex is at least 2.5.20 to support bison-bridge |
|---|
| 68 | # how to do the check with cmake??? |
|---|
| 69 | |
|---|
| 70 | # Add this to workaround an apparent bug in FreeBSD cmake (already defined in Linux) |
|---|
| 71 | SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic") |
|---|
| 72 | |
|---|
| 73 | # Location for the include files |
|---|
| 74 | INCLUDE_DIRECTORIES(include) |
|---|
| 75 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include) |
|---|
| 76 | SUBDIRS(include/freeDiameter) |
|---|
| 77 | |
|---|
| 78 | # Location for the source code |
|---|
| 79 | SUBDIRS(libfreeDiameter) |
|---|
| 80 | SUBDIRS(freeDiameter) |
|---|
| 81 | |
|---|
| 82 | # Extensions (there is no use of freeDiameter without any extension) |
|---|
| 83 | SUBDIRS(extensions) |
|---|