diff include/freeDiameter/CMakeLists.txt @ 316:aa8f41bca657

Fixed libraries dependencies
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 19 May 2010 11:54:55 +0900
parents 6fd1e6f56af5
children 41e3c2a3721c
line wrap: on
line diff
--- a/include/freeDiameter/CMakeLists.txt	Wed May 19 11:36:03 2010 +0900
+++ b/include/freeDiameter/CMakeLists.txt	Wed May 19 11:54:55 2010 +0900
@@ -27,14 +27,26 @@
 INCLUDE (CheckCSourceCompiles)
 INCLUDE (TestBigEndian)
 
-# We use dlopen and dlclose
-SET(FD_LIBS ${FD_LIBS} ${CMAKE_DL_LIBS})
+# Check byte ordering
+TEST_BIG_ENDIAN(HOST_BIG_ENDIAN)
+
+# We need the getopt_long function
+CHECK_FUNCTION_EXISTS (getopt_long HAVE_LONG_OPTIONS)
+IF (NOT HAVE_LONG_OPTIONS)
+   MESSAGE(SEND_ERROR "The getopt_long function is not found, please add needed library in build system")
+ENDIF (NOT HAVE_LONG_OPTIONS)
 
-# We need the threads library (pthread)
+# Check if ntohll is provided on the system
+CHECK_SYMBOL_EXISTS(ntohll "" HAVE_NTOHLL)
+
+# malloc.h ?
+CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
+
+
+# pthreads
 INCLUDE(FindThreads)
-SET(FD_LIBS ${FD_LIBS} ${CMAKE_THREAD_LIBS_INIT})
 
-# We need the clock_gettime function ( -lrt, -lposix4 )
+# clock_gettime
 CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
 IF (HAVE_CLOCK_GETTIME)
    SET(CLOCK_GETTIME_LIBS "")
@@ -49,7 +61,12 @@
      ENDIF (HAVE_LIBPOSIX4)
    ENDIF (HAVE_LIBRT)
 ENDIF (HAVE_CLOCK_GETTIME)
-SET(FD_LIBS ${FD_LIBS} ${CLOCK_GETTIME_LIBS})
+
+# LFD_LIBS = libraries required by the libfreeDiameter.
+SET(LFD_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT})
+
+
+# dlopen and dlclose: CMAKE_DL_LIBS
 
 # We need the sctp_connectx function among others
 # We need the IPPROTO_SCTP symbol from sys/socket.h, netinet/in.h or netinet/sctp.h
@@ -58,7 +75,6 @@
 	IF(NOT HAVE_NATIVE_SCTP)
 		FIND_PACKAGE(SCTP REQUIRED)
 		INCLUDE_DIRECTORIES(${SCTP_INCLUDE_DIRS})
-		SET(FD_LIBS ${FD_LIBS} ${SCTP_LIBRARIES})
 	ENDIF(NOT HAVE_NATIVE_SCTP)
 	# Now check the number of args of this function, since it changed between Ubuntu 9.04 and 9.10
    	SET(CHECK_SCTP_CONNECTX_4_ARGS_SOURCE_CODE "
@@ -74,20 +90,9 @@
 	MESSAGE(STATUS "Disabled SCTP support.")
 ENDIF(NOT DISABLE_SCTP)
 
-# Check byte ordering
-TEST_BIG_ENDIAN(HOST_BIG_ENDIAN)
 
-# We need the getopt_long function
-CHECK_FUNCTION_EXISTS (getopt_long HAVE_LONG_OPTIONS)
-IF (NOT HAVE_LONG_OPTIONS)
-   MESSAGE(SEND_ERROR "The getopt_long function is not found, please add needed library in build system")
-ENDIF (NOT HAVE_LONG_OPTIONS)
-
-# Check if ntohll is provided on the system
-CHECK_SYMBOL_EXISTS(ntohll "" HAVE_NTOHLL)
-
-# malloc.h ?
-CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
+# FD_LIBS = libraries required by the daemon
+SET(FD_LIBS ${CMAKE_DL_LIBS} ${SCTP_LIBRARIES})
 
 ##########################
 # Create the absolute path for searching extensions
@@ -99,7 +104,8 @@
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeDiameter-host.h.in ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h)
 
 # Save some variables for the other directories
-SET(FD_LIBS ${FD_LIBS} PARENT_SCOPE)
+SET(FD_LIBS  ${FD_LIBS}  PARENT_SCOPE)
+SET(LFD_LIBS ${LFD_LIBS} PARENT_SCOPE)
 
 ####
 ## INSTALL section ##
"Welcome to our mercurial repository"