Navigation


source: freeDiameter/include/freeDiameter/CMakeLists.txt @ 24:bd83ce9328ed

Last change on this file since 24:bd83ce9328ed was 24:bd83ce9328ed, checked in by Sebastien Decugis <sdecugis@nict.go.jp>, 11 years ago

Cleanups and completed sctp code (not finished)

File size: 2.9 KB
Line 
1#CMake configuration for freeDiameter include directory
2
3Project("freeDiameter include directory" C)
4
5########################
6# Configurable parameters
7
8# Name of the default configuration file
9OPTION(DEFAULT_CONF_FILE "Default path to configuration file?" OFF)
10
11# Disable SCTP support completly ?
12OPTION(DISABLE_SCTP "Disable SCTP support?" OFF)
13IF (NOT DISABLE_SCTP)
14        OPTION(DEBUG_SCTP "Verbose SCTP (for debug)?" OFF)
15        OPTION(SCTP_USE_MAPPED_ADDRESSES "Use v6-mapped v4 addresses in SCTP (workaround some SCTP limitations)?" OFF)
16ENDIF (NOT DISABLE_SCTP)
17
18# Find TODO items in the code easily ?
19OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF)
20
21
22########################
23# System checks
24
25INCLUDE (CheckLibraryExists)
26INCLUDE (CheckFunctionExists)
27INCLUDE (CheckIncludeFiles)
28INCLUDE (CheckSymbolExists)
29INCLUDE (TestBigEndian)
30
31# We use dlopen and dlclose
32SET(FD_LIBS ${FD_LIBS} ${CMAKE_DL_LIBS})
33
34# We need the threads library (pthread)
35INCLUDE(FindThreads)
36SET(FD_LIBS ${FD_LIBS} ${CMAKE_THREAD_LIBS_INIT})
37
38# We need the clock_gettime function ( -lrt, -lposix4 )
39CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
40IF (HAVE_CLOCK_GETTIME)
41   SET(CLOCK_GETTIME_LIBS "")
42ELSE (HAVE_CLOCK_GETTIME)
43   CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_LIBRT)
44   IF (HAVE_LIBRT)
45     SET(CLOCK_GETTIME_LIBS "-lrt")
46   ELSE (HAVE_LIBRT)
47     CHECK_LIBRARY_EXISTS (posix4 clock_gettime "" HAVE_LIBPOSIX4)
48     IF (HAVE_LIBPOSIX4)
49       SET(CLOCK_GETTIME_LIBS "-lposix4")
50     ENDIF (HAVE_LIBPOSIX4)
51   ENDIF (HAVE_LIBRT)
52ENDIF (HAVE_CLOCK_GETTIME)
53SET(FD_LIBS ${FD_LIBS} ${CLOCK_GETTIME_LIBS})
54
55# We need the sctp_getladdrs function ( -lsctp )
56# We need the IPPROTO_SCTP symbol from sys/socket.h, netinet/in.h or netinet/sctp.h
57IF(NOT DISABLE_SCTP)
58        CHECK_FUNCTION_EXISTS(sctp_getladdrs HAVE_NATIVE_SCTP)
59        IF(NOT HAVE_NATIVE_SCTP)
60                FIND_PACKAGE(SCTP REQUIRED)
61                INCLUDE_DIRECTORIES(${SCTP_INCLUDE_DIRS})
62                SET(FD_LIBS ${FD_LIBS} ${SCTP_LIBRARIES})
63        ENDIF(NOT HAVE_NATIVE_SCTP)
64ENDIF(NOT DISABLE_SCTP)
65
66# Check byte ordering
67TEST_BIG_ENDIAN(HOST_BIG_ENDIAN)
68
69# We need the getopt_long function
70CHECK_FUNCTION_EXISTS (getopt_long HAVE_LONG_OPTIONS)
71IF (NOT HAVE_LONG_OPTIONS)
72   MESSAGE(SEND_ERROR "The getopt_long function is not found, please add needed library in build system")
73ENDIF (NOT HAVE_LONG_OPTIONS)
74
75# Check if ntohll is provided on the system
76CHECK_SYMBOL_EXISTS(ntohll "" HAVE_NTOHLL)
77
78# malloc.h ?
79CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
80
81# signalent.h ? -- found in strace distrib; just for nice signal names...
82CHECK_INCLUDE_FILES (signalent.h HAVE_SIGNALENT_H)
83
84# The default configuration file name
85IF (NOT DEFAULT_CONF_FILE)
86   SET(DEFAULT_CONF_FILE "freeDiameter.conf")
87ENDIF (NOT DEFAULT_CONF_FILE)
88##########################
89
90# Generate the host.h file
91CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeDiameter-host.h.in ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h)
92
93# Save the FD_LIBS for parent scope
94SET(FD_LIBS ${FD_LIBS} PARENT_SCOPE)
Note: See TracBrowser for help on using the repository browser.