Mercurial > hg > freeDiameter
annotate include/freeDiameter/CMakeLists.txt @ 304:ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 14 May 2010 17:26:53 +0900 |
parents | 60f34df3e025 |
children | 61f78fdbacc2 |
rev | line source |
---|---|
1
bafb831ba688
Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
0
diff
changeset
|
1 #CMake configuration for freeDiameter include directory |
0 | 2 |
1
bafb831ba688
Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
0
diff
changeset
|
3 Project("freeDiameter include directory" C) |
0 | 4 |
5 ######################## | |
6 # Configurable parameters | |
7 | |
304
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
8 # The default directory for configuration files |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
9 SET(DEFAULT_CONF_PATH ${CMAKE_INSTALL_PREFIX}/etc/freeDiameter CACHE PATH "Default location of freeDiameter configuration files") |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
10 |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
11 # The default directory for extension files |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
12 SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/lib/fdx CACHE PATH "Default location of freeDiameter extensions") |
0 | 13 |
14 # Disable SCTP support completly ? | |
23
db6c40b8b307
Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
17
diff
changeset
|
15 OPTION(DISABLE_SCTP "Disable SCTP support?" OFF) |
db6c40b8b307
Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
17
diff
changeset
|
16 IF (NOT DISABLE_SCTP) |
db6c40b8b307
Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
17
diff
changeset
|
17 OPTION(DEBUG_SCTP "Verbose SCTP (for debug)?" OFF) |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
23
diff
changeset
|
18 OPTION(SCTP_USE_MAPPED_ADDRESSES "Use v6-mapped v4 addresses in SCTP (workaround some SCTP limitations)?" OFF) |
304
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
19 ELSE (NOT DISABLE_SCTP) |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
20 MESSAGE(STATUS "Disabled SCTP support.") |
23
db6c40b8b307
Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
17
diff
changeset
|
21 ENDIF (NOT DISABLE_SCTP) |
0 | 22 |
17
ab3c58d88be3
Added proper gcrypt initializer
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
13
diff
changeset
|
23 # Find TODO items in the code easily ? |
13
ef9ef3bf4752
Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
24 OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF) |
ef9ef3bf4752
Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
25 |
304
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
26 MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO) |
0 | 27 |
28 ######################## | |
29 # System checks | |
30 | |
31 INCLUDE (CheckLibraryExists) | |
32 INCLUDE (CheckFunctionExists) | |
33 INCLUDE (CheckIncludeFiles) | |
34 INCLUDE (CheckSymbolExists) | |
51
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
35 INCLUDE (CheckCSourceCompiles) |
0 | 36 INCLUDE (TestBigEndian) |
37 | |
38 # We use dlopen and dlclose | |
39 SET(FD_LIBS ${FD_LIBS} ${CMAKE_DL_LIBS}) | |
40 | |
41 # We need the threads library (pthread) | |
42 INCLUDE(FindThreads) | |
43 SET(FD_LIBS ${FD_LIBS} ${CMAKE_THREAD_LIBS_INIT}) | |
44 | |
45 # We need the clock_gettime function ( -lrt, -lposix4 ) | |
46 CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME) | |
47 IF (HAVE_CLOCK_GETTIME) | |
48 SET(CLOCK_GETTIME_LIBS "") | |
49 ELSE (HAVE_CLOCK_GETTIME) | |
50 CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_LIBRT) | |
51 IF (HAVE_LIBRT) | |
52 SET(CLOCK_GETTIME_LIBS "-lrt") | |
53 ELSE (HAVE_LIBRT) | |
54 CHECK_LIBRARY_EXISTS (posix4 clock_gettime "" HAVE_LIBPOSIX4) | |
55 IF (HAVE_LIBPOSIX4) | |
56 SET(CLOCK_GETTIME_LIBS "-lposix4") | |
57 ENDIF (HAVE_LIBPOSIX4) | |
58 ENDIF (HAVE_LIBRT) | |
59 ENDIF (HAVE_CLOCK_GETTIME) | |
60 SET(FD_LIBS ${FD_LIBS} ${CLOCK_GETTIME_LIBS}) | |
61 | |
51
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
62 # We need the sctp_connectx function among others |
0 | 63 # We need the IPPROTO_SCTP symbol from sys/socket.h, netinet/in.h or netinet/sctp.h |
64 IF(NOT DISABLE_SCTP) | |
51
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
65 CHECK_FUNCTION_EXISTS(sctp_connectx HAVE_NATIVE_SCTP) |
0 | 66 IF(NOT HAVE_NATIVE_SCTP) |
67 FIND_PACKAGE(SCTP REQUIRED) | |
68 INCLUDE_DIRECTORIES(${SCTP_INCLUDE_DIRS}) | |
69 SET(FD_LIBS ${FD_LIBS} ${SCTP_LIBRARIES}) | |
70 ENDIF(NOT HAVE_NATIVE_SCTP) | |
51
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
71 # Now check the number of args of this function, since it changed between Ubuntu 9.04 and 9.10 |
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
72 SET(CHECK_SCTP_CONNECTX_4_ARGS_SOURCE_CODE " |
168
6db078b955e3
Completed rt_default extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
51
diff
changeset
|
73 #include <unistd.h> |
6db078b955e3
Completed rt_default extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
51
diff
changeset
|
74 #include <netinet/sctp.h> |
51
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
75 int main() { |
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
76 return sctp_connectx(0, NULL, 0, NULL); |
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
77 } |
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
78 ") |
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
79 SET(CMAKE_REQUIRED_LIBRARIES ${SCTP_LIBRARIES}) |
08d8cbeff30b
Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
80 CHECK_C_SOURCE_COMPILES("${CHECK_SCTP_CONNECTX_4_ARGS_SOURCE_CODE}" SCTP_CONNECTX_4_ARGS) |
0 | 81 ENDIF(NOT DISABLE_SCTP) |
82 | |
83 # Check byte ordering | |
84 TEST_BIG_ENDIAN(HOST_BIG_ENDIAN) | |
85 | |
86 # We need the getopt_long function | |
87 CHECK_FUNCTION_EXISTS (getopt_long HAVE_LONG_OPTIONS) | |
88 IF (NOT HAVE_LONG_OPTIONS) | |
89 MESSAGE(SEND_ERROR "The getopt_long function is not found, please add needed library in build system") | |
90 ENDIF (NOT HAVE_LONG_OPTIONS) | |
91 | |
92 # Check if ntohll is provided on the system | |
93 CHECK_SYMBOL_EXISTS(ntohll "" HAVE_NTOHLL) | |
94 | |
95 # malloc.h ? | |
96 CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H) | |
97 | |
98 ########################## | |
99 | |
100 # Generate the host.h file | |
1
bafb831ba688
Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
0
diff
changeset
|
101 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeDiameter-host.h.in ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h) |
0 | 102 |
304
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
103 # Save some variables for the other directories |
0 | 104 SET(FD_LIBS ${FD_LIBS} PARENT_SCOPE) |
304
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
105 SET(DEFAULT_CONF_PATH ${DEFAULT_CONF_PATH} PARENT_SCOPE) |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
106 SET(DEFAULT_EXTENSIONS_PATH ${DEFAULT_EXTENSIONS_PATH} PARENT_SCOPE) |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
107 |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
108 |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
109 #### |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
110 ## INSTALL section ## |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
111 |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
112 # The headers from this directory are required to develop new extensions for freeDiameter. |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
113 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h libfreeDiameter.h freeDiameter.h extension.h |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
114 DESTINATION include/freeDiameter |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
115 COMPONENT freeDiameter-dev) |
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
236
diff
changeset
|
116 |