changeset 668:4ef3b7cdf734

Some more cleanups in linking
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 17 Jan 2011 14:08:08 +0900
parents 1f7c7ce85db3
children 26482481d4ef
files contrib/debian/control include/freeDiameter/CMakeLists.txt libfdcore/CMakeLists.txt libfdproto/CMakeLists.txt tests/CMakeLists.txt
diffstat 5 files changed, 51 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/debian/control	Mon Jan 17 13:03:14 2011 +0900
+++ b/contrib/debian/control	Mon Jan 17 14:08:08 2011 +0900
@@ -128,7 +128,7 @@
 
 Package: freediameter-radius-gateway
 Architecture: any
-Depends: ${misc:Depends}, freediameter-common (= ${binary:Version})
+Depends: ${misc:Depends}, freediameter-daemon (= ${binary:Version})
 Suggests: freediameter-dictionary-rfc4072 (= ${binary:Version}), freediameter-dictionary-rfc4740 (= ${binary:Version})
 Description: RADIUS/Diameter extensible gateway.
  This freeDiameter extension implements a RADIUS to Diameter
@@ -161,7 +161,7 @@
 
 Package: freediameter-accounting-server
 Architecture: any
-Depends: ${misc:Depends}, freediameter-common (= ${binary:Version}), libpq5
+Depends: ${misc:Depends}, freediameter-daemon (= ${binary:Version}), libpq5
 Suggests: freediameter-dictionary-rfc4072
 Description: freeDiameter simple Accounting server.
  This freeDiameter extension implements the Diameter Base 
@@ -181,7 +181,7 @@
 
 Package: freediameter-eap-server
 Architecture: any
-Depends: ${misc:Depends}, freediameter-common (= ${binary:Version}), libmysqlclient16, freediameter-dictionary-rfc4072 (= ${binary:Version})
+Depends: ${misc:Depends}, freediameter-daemon (= ${binary:Version}), libmysqlclient16, freediameter-dictionary-rfc4072 (= ${binary:Version})
 Description: freeDiameter Diameter EAP server implementation.
  This freeDiameter extension implements a Diameter EAP server. 
  It supports EAP-MD5 and EAP-TLS methods currently.
@@ -196,7 +196,7 @@
 
 Package: freediameter-sip-server
 Architecture: any
-Depends: ${misc:Depends}, freediameter-common (= ${binary:Version}), libmysqlclient16, freediameter-dictionary-rfc4740 (= ${binary:Version})
+Depends: ${misc:Depends}, freediameter-daemon (= ${binary:Version}), libmysqlclient16, freediameter-dictionary-rfc4740 (= ${binary:Version})
 Description: freeDiameter Diameter SIP server implementation.
  This freeDiameter extension implements a prototype 
  Diameter SIP server.
--- a/include/freeDiameter/CMakeLists.txt	Mon Jan 17 13:03:14 2011 +0900
+++ b/include/freeDiameter/CMakeLists.txt	Mon Jan 17 14:08:08 2011 +0900
@@ -15,10 +15,14 @@
 # Find TODO items in the code easily ?
 OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF)
 
+# Create the absolute path for searching extensions
+SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_EXTENSIONS_SUFFIX})
+
+
 MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO)
 
 ########################
-# System checks 
+### System checks part
 
 INCLUDE (CheckLibraryExists)
 INCLUDE (CheckFunctionExists)
@@ -27,8 +31,8 @@
 INCLUDE (CheckCSourceCompiles)
 INCLUDE (TestBigEndian)
 
-# Check byte ordering
-TEST_BIG_ENDIAN(HOST_BIG_ENDIAN)
+
+### System checks -- mandatory support
 
 # We need the getopt_long function
 CHECK_FUNCTION_EXISTS (getopt_long HAVE_LONG_OPTIONS)
@@ -36,20 +40,30 @@
    MESSAGE(SEND_ERROR "The getopt_long function is not found, please add needed library in build system")
 ENDIF (NOT HAVE_LONG_OPTIONS)
 
+# getifaddrs ?
+CHECK_FUNCTION_EXISTS (getifaddrs HAVE_GETIFADDRS)
+IF (NOT HAVE_GETIFADDRS)
+   MESSAGE(SEND_ERROR "The getifaddrs function is currently required by freeDiameter.")
+ENDIF (NOT HAVE_GETIFADDRS)
+
+
+### System checks -- for freeDiameter-host.h
+
+# Check byte ordering
+TEST_BIG_ENDIAN(HOST_BIG_ENDIAN)
+
 # Check if ntohll is provided on the system
 CHECK_SYMBOL_EXISTS(ntohll "" HAVE_NTOHLL)
 
 # malloc.h ?
 CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
 
-# getifaddrs ?
-CHECK_FUNCTION_EXISTS (getifaddrs HAVE_GETIFADDRS)
-IF (NOT HAVE_GETIFADDRS)
-   MESSAGE(SEND_ERROR "The getifaddrs function is currently required by freeDiameter.")
-ENDIF (NOT HAVE_GETIFADDRS)
+
+### System checks -- for includes / link
 
 # pthreads
 INCLUDE(FindThreads)
+SET(CMAKE_THREAD_LIBS_INIT ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE)
 
 # clock_gettime
 CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
@@ -66,10 +80,7 @@
      ENDIF (HAVE_LIBPOSIX4)
    ENDIF (HAVE_LIBRT)
 ENDIF (HAVE_CLOCK_GETTIME)
-
-# LFDPROTO_LIBS = libraries required by the libfdproto.
-SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE)
-
+SET(CLOCK_GETTIME_LIBS ${CLOCK_GETTIME_LIBS} PARENT_SCOPE)
 
 # dlopen and dlclose: CMAKE_DL_LIBS
 
@@ -94,16 +105,21 @@
 ELSE (NOT DISABLE_SCTP)
 	MESSAGE(STATUS "Disabled SCTP support.")
 ENDIF(NOT DISABLE_SCTP)
+SET(SCTP_INCLUDE_DIR ${SCTP_INCLUDE_DIR} PARENT_SCOPE)
+SET(SCTP_LIBRARIES ${SCTP_LIBRARIES} PARENT_SCOPE)
 
 
 # Require GNU TLS for building the library
 FIND_PACKAGE(GnuTLS REQUIRED)
+SET(GNUTLS_INCLUDE_DIR ${GNUTLS_INCLUDE_DIR} PARENT_SCOPE)
+SET(GNUTLS_LIBRARIES ${GNUTLS_LIBRARIES} PARENT_SCOPE)
 
 find_path(GCRYPT_INCLUDE_DIR NAMES gcrypt.h)
 If ( NOT GCRYPT_INCLUDE_DIR )
 	MESSAGE(SEND_ERROR "Unable to find gcrypt.h, please install libgcrypt-dev or equivalent")
 Endif ( NOT GCRYPT_INCLUDE_DIR )
 MARK_AS_ADVANCED(GCRYPT_INCLUDE_DIR)
+SET(GCRYPT_INCLUDE_DIR ${GCRYPT_INCLUDE_DIR} PARENT_SCOPE)
 
 # Also we need libgcrypt to... display its version :(
 find_library(GCRYPT_LIBRARY 
@@ -112,15 +128,23 @@
 If ( NOT GCRYPT_LIBRARY )
 	MESSAGE(SEND_ERROR "Unable to find libgcrypt, please install libgcrypt or equivalent")
 Endif ( NOT GCRYPT_LIBRARY )
+SET(GCRYPT_LIBRARY ${GCRYPT_LIBRARY} PARENT_SCOPE)
 
 
-# LFDCORE_LIBS = libraries required by the libfdcore
-SET(LFDCORE_LIBS ${CMAKE_DL_LIBS} ${SCTP_LIBRARIES} ${GCRYPT_LIBRARY} ${GNUTLS_LIBRARIES} PARENT_SCOPE)
-SET(LFDCORE_INCLUDES ${SCTP_INCLUDE_DIR} ${GNUTLS_INCLUDE_DIR} ${GCRYPT_INCLUDE_DIR} PARENT_SCOPE)
+##########################
+
+# LFDPROTO_LIBS = libraries required by the libfdproto.
+SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE)
+# Dependencies: the libraries required by any code linking to libfdproto.
+SET(LFDPROTO_LINK_INTERFACES ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE)
 
-##########################
-# Create the absolute path for searching extensions
-SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_EXTENSIONS_SUFFIX})
+# LFDCORE_LIBS = libraries required by the libfdcore (in addition to libfdproto and its dependencies)
+SET(LFDCORE_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_DL_LIBS} ${SCTP_LIBRARIES} ${GCRYPT_LIBRARY} ${GNUTLS_LIBRARIES} PARENT_SCOPE)
+# And includes paths
+SET(LFDCORE_INCLUDES ${SCTP_INCLUDE_DIR} ${GNUTLS_INCLUDE_DIR} ${GCRYPT_INCLUDE_DIR} PARENT_SCOPE)
+# And dependencies
+SET(LFDCORE_LINK_INTERFACES "" PARENT_SCOPE) # We don't force any other library, the programs will link with what they needs 
+                                             # (such as libgnutls if they use GNUTLS_DEBUG() macro)
 
 ##########################
 
--- a/libfdcore/CMakeLists.txt	Mon Jan 17 13:03:14 2011 +0900
+++ b/libfdcore/CMakeLists.txt	Mon Jan 17 14:08:08 2011 +0900
@@ -58,7 +58,8 @@
 SET_TARGET_PROPERTIES(libfdcore PROPERTIES 
 	OUTPUT_NAME "fdcore"
 	SOVERSION ${FD_PROJECT_VERSION_API}
-	VERSION ${FD_PROJECT_VERSION_MAJOR}.${FD_PROJECT_VERSION_MINOR}.${FD_PROJECT_VERSION_REV})
+	VERSION ${FD_PROJECT_VERSION_MAJOR}.${FD_PROJECT_VERSION_MINOR}.${FD_PROJECT_VERSION_REV}
+	LINK_INTERFACE_LIBRARIES "${LFDCORE_LINK_INTERFACES}")
 
 # The library itself needs other libraries 
 LINK_DIRECTORIES(${CURRENT_BINARY_DIR}/../libfdproto)
--- a/libfdproto/CMakeLists.txt	Mon Jan 17 13:03:14 2011 +0900
+++ b/libfdproto/CMakeLists.txt	Mon Jan 17 14:08:08 2011 +0900
@@ -25,7 +25,8 @@
 SET_TARGET_PROPERTIES(libfdproto PROPERTIES 
 	OUTPUT_NAME "fdproto"
 	SOVERSION ${FD_PROJECT_VERSION_API}
-	VERSION ${FD_PROJECT_VERSION_MAJOR}.${FD_PROJECT_VERSION_MINOR}.${FD_PROJECT_VERSION_REV})
+	VERSION ${FD_PROJECT_VERSION_MAJOR}.${FD_PROJECT_VERSION_MINOR}.${FD_PROJECT_VERSION_REV}
+	LINK_INTERFACE_LIBRARIES "${LFDPROTO_LINK_INTERFACES}")
 
 # The library itself needs other libraries 
 TARGET_LINK_LIBRARIES(libfdproto ${LFDPROTO_LIBS})
--- a/tests/CMakeLists.txt	Mon Jan 17 13:03:14 2011 +0900
+++ b/tests/CMakeLists.txt	Mon Jan 17 14:08:08 2011 +0900
@@ -89,7 +89,7 @@
 # Compile each test
 FOREACH( TEST ${TEST_LIST} )
    ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h ${${TEST}_ADDITIONAL})
-   TARGET_LINK_LIBRARIES(${TEST} libfdproto libfdcore ${${TEST}_ADDITIONAL_LIB})
+   TARGET_LINK_LIBRARIES(${TEST} libfdproto libfdcore ${${TEST}_ADDITIONAL_LIB} ${CLOCK_GETTIME_LIBS})
    ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
 ENDFOREACH( TEST )
 
"Welcome to our mercurial repository"