Index: freeDiameter/CMakeLists.txt
===================================================================
--- freeDiameter/CMakeLists.txt	(revision 313)
+++ freeDiameter/CMakeLists.txt	(revision 316)
@@ -74,8 +74,4 @@
 	SUBDIRS(tests)
 ENDIF ( NOT SKIP_TESTS )
-IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
-  MARK_AS_ADVANCED(SKIP_TESTS)
-ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
-
 
 ####
Index: freeDiameter/tests/CMakeLists.txt
===================================================================
--- freeDiameter/tests/CMakeLists.txt	(revision 304)
+++ freeDiameter/tests/CMakeLists.txt	(revision 316)
@@ -49,4 +49,5 @@
 # Create an archive with the daemon common files (all but main)
 ADD_LIBRARY(fDcore STATIC ${TEST_COMMON_SRC})
+
 
 ##############################
@@ -107,5 +108,5 @@
 FOREACH( TEST ${TEST_LIST} )
    ADD_EXECUTABLE(${TEST} ${TEST}.c tests.h ${${TEST}_ADDITIONAL})
-   TARGET_LINK_LIBRARIES(${TEST} fDcore ${FD_LIBS} ${${TEST}_ADDITIONAL_LIB})
+   TARGET_LINK_LIBRARIES(${TEST} fDcore ${FD_LIBS} ${LFD_LIBS} ${${TEST}_ADDITIONAL_LIB})
    ADD_TEST(${TEST} ${EXECUTABLE_OUTPUT_PATH}/${TEST})
 ENDFOREACH( TEST )
Index: include/freeDiameter/CMakeLists.txt
===================================================================
--- include/freeDiameter/CMakeLists.txt	(revision 313)
+++ include/freeDiameter/CMakeLists.txt	(revision 316)
@@ -28,12 +28,24 @@
 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 threads library (pthread)
+# 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)
+
+
+# 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)
@@ -50,5 +62,10 @@
    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
@@ -59,5 +76,4 @@
 		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
@@ -75,18 +91,7 @@
 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})
 
 ##########################
@@ -100,5 +105,6 @@
 
 # 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)
 
 ####
Index: libfreeDiameter/CMakeLists.txt
===================================================================
--- libfreeDiameter/CMakeLists.txt	(revision 313)
+++ libfreeDiameter/CMakeLists.txt	(revision 316)
@@ -24,5 +24,5 @@
 
 # The library itself needs other libraries 
-TARGET_LINK_LIBRARIES(libfreeDiameter ${FD_LIBS})
+TARGET_LINK_LIBRARIES(libfreeDiameter ${LFD_LIBS})
 
 # Save the list of files for testcases in the daemon's directory
