[Openvas-commits] r6182 - in trunk/gsa: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Dec 18 10:00:41 CET 2009


Author: felix
Date: 2009-12-18 10:00:40 +0100 (Fri, 18 Dec 2009)
New Revision: 6182

Modified:
   trunk/gsa/CMakeLists.txt
   trunk/gsa/ChangeLog
   trunk/gsa/src/CMakeLists.txt
Log:
* CMakeLists.txt, src/CMakeLists.txt: Added checks for gnutls, libxml
and libxslt. Tried to use "elegant" cmake mechanisms to add the
respective linker and compiler flags, but failed.
Todo with link to workaround added.


Modified: trunk/gsa/CMakeLists.txt
===================================================================
--- trunk/gsa/CMakeLists.txt	2009-12-17 18:46:08 UTC (rev 6181)
+++ trunk/gsa/CMakeLists.txt	2009-12-18 09:00:40 UTC (rev 6182)
@@ -49,6 +49,8 @@
                         " to retrieve information about installed"
                         " openvas-libraries in the system.")
 
+## TODO this check is obsolete with the FindPkgConfig module (see below,
+## pkg_check_module sets OKG_CONFIG_FOUND)
 MESSAGE(STATUS "Looking for pkg-config... ${PATH_TO_PKGCONFIG}")
 IF(NOT PATH_TO_PKGCONFIG)
   SET(MANDATORY_TOOL_MISSING TRUE)
@@ -74,17 +76,17 @@
 #       (with the later 4 being optional)
 
 ## Check for existance of required libraries
-pkg_check_modules (MHD libmicrohttpd>=0.4.2)
+pkg_check_modules (LIBS REQUIRED libmicrohttpd>=0.4.2 libxml-2.0 glib-2.0 
+                   gthread-2.0)
 
-if (NOT MHD_FOUND)
-  message (FATAL_ERROR "libmicrohttpd>=0.4.2 could not be found on "
-                       "your system but is required. This library was searched "
-                       "for using the pkg-config tool. If you have "
-                       "libmicrohttpd installed, make sure that "
-                       "PKG_CONFIG_PATH points to a path where "
-                       "libmicrohttpd.pc can be found.")
-endif (NOT MHD_FOUND)
+pkg_check_modules (GSAD_LIBS REQUIRED libxslt gnutls)
 
+if (NOT LIBS_FOUND OR NOT GSAD_LIBS_FOUND)
+  message (FATAL_ERROR "One or more reguired libraries was not found "
+                       "(see message above), please install the missing "
+                       "libraries and run cmake again.")
+endif (NOT LIBS_FOUND OR NOT GSAD_LIBS_FOUND)
+
 ## Retrieve svn revision (at configure time)
 #  Not using Subversion_WC_INFO, as it would have to connect to the repo
 FIND_PROGRAM(SVN_EXECUTABLE svn DOC "subversion command line client")

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2009-12-17 18:46:08 UTC (rev 6181)
+++ trunk/gsa/ChangeLog	2009-12-18 09:00:40 UTC (rev 6182)
@@ -1,3 +1,10 @@
+2009-12-18  Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
+	* CMakeLists.txt, src/CMakeLists.txt: Added checks for gnutls, libxml
+	and libxslt. Tried to use "elegant" cmake mechanisms to add the
+	respective linker and compiler flags, but failed.
+	Todo with link to workaround added.
+
 2009-12-17  Matthew Mundell <matthew.mundell at intevation.de>
 
 	* src/html/src/omp.xsl (html-config-table): Bold name.

Modified: trunk/gsa/src/CMakeLists.txt
===================================================================
--- trunk/gsa/src/CMakeLists.txt	2009-12-17 18:46:08 UTC (rev 6181)
+++ trunk/gsa/src/CMakeLists.txt	2009-12-18 09:00:40 UTC (rev 6182)
@@ -27,29 +27,12 @@
 
 add_definitions (-Werror)
 
+include_directories (${LIBS_INCLUDE_DIRS} ${GSAD_LIBS_INCLUDE_DIRS})
+link_directories    (${LIBS_LIBRARY_DIRS} ${GSAD_LIBS_LIBRARY_DIRS})
+
 ## TODO use pkg_check_modules instead of manual invocation (as in top-level
 ## CMakeLists.txt)
-exec_program (pkg-config
-              ARGS --cflags gthread-2.0
-              OUTPUT_VARIABLE GLIB_THREAD_CFLAGS)
-exec_program (pkg-config
-              ARGS --libs gthread-2.0
-              OUTPUT_VARIABLE GLIB_THREAD_LDFLAGS)
 
-exec_program (pkg-config
-              ARGS --cflags glib-2.0
-              OUTPUT_VARIABLE GLIB_CFLAGS)
-exec_program (pkg-config
-              ARGS --libs glib-2.0
-              OUTPUT_VARIABLE GLIB_LDFLAGS)
-
-exec_program (pkg-config
-              ARGS --cflags libxml-2.0
-              OUTPUT_VARIABLE LIBXML_CFLAGS)
-exec_program (pkg-config
-              ARGS --libs libxml-2.0
-              OUTPUT_VARIABLE LIBXML_LDFLAGS)
-
 exec_program (libopenvas-config
               ARGS --cflags
               OUTPUT_VARIABLE OPENVAS_CFLAGS)
@@ -73,19 +56,18 @@
 ## Libraries
 
 add_library (gsad_base STATIC gsad_base.c)
-set_target_properties (gsad_base PROPERTIES COMPILE_FLAGS "${HEADER_TEMP} ${TASKS_CFLAG} ${GLIB_THREAD_CFLAGS} ${GLIB_CFLAGS} ${LIBXML_CFLAGS}")
+target_link_libraries (gsad_base ${LIBS_LIBRARIES})
 
 add_library (gsad_omp STATIC gsad_omp.c)
-set_target_properties (gsad_omp PROPERTIES COMPILE_FLAGS "${HEADER_TEMP} ${TASKS_CFLAG} ${GLIB_THREAD_CFLAGS} ${GLIB_CFLAGS} ${LIBXML_CFLAGS}")
+target_link_libraries (gsad_omp ${LIBS_LIBRARIES})
 
 add_library (gsad_oap STATIC gsad_oap.c)
-set_target_properties (gsad_oap PROPERTIES COMPILE_FLAGS "${HEADER_TEMP} ${TASKS_CFLAG} ${GLIB_THREAD_CFLAGS} ${GLIB_CFLAGS} ${LIBXML_CFLAGS}")
+target_link_libraries (gsad_oap ${LIBS_LIBRARIES})
 
 ## Program
 
 add_executable (gsad gsad.c validator.c)
-target_link_libraries (gsad gsad_omp gsad_oap gsad_base)
-
+target_link_libraries (gsad gsad_omp gsad_oap gsad_base ${GSAD_LIBS_LIBRARIES})
 set_target_properties (gsad PROPERTIES LINKER_LANGUAGE C)
 
 if (GSAD_VERSION)
@@ -127,14 +109,15 @@
 add_definitions (-DOPENVAS_OS_NAME=\\\"${CMAKE_SYSTEM}\\\")
 add_definitions (-DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\")
 
-## In the top-level CMakeLists.txt, microhttpd is searched for using
+## TODO In the top-level CMakeLists.txt, microhttpd is searched for using
 ## pkg_check_modules. Use variables set by this function as linker and compiler
-## flags.
+## flags. Unfortunately it boils down to this problem:
+## http://www.cmake.org/pipermail/cmake/2009-June/030108.html
 set_target_properties (gsad PROPERTIES LINK_FLAGS
-                       "${LIB_TEMP} -lgnutls ${GLIB_THREAD_LDFLAGS} ${GLIB_LDFLAGS} ${OPENVAS_LDFLAGS} -lmicrohttpd -pthread -lxslt ${LIBXML_LDFLAGS}")
+                       "${LIBS_TEMP} ${OPENVAS_LDFLAGS} -pthread ")
 
 set_target_properties (gsad PROPERTIES COMPILE_FLAGS
-                       "${HEADER_TEMP} ${OPENVAS_CFLAGS} ${GLIB_THREAD_CFLAGS} ${GLIB_CFLAGS} ${LIBXML_CFLAGS}")
+                       "${HEADER_TEMP} ${OPENVAS_CFLAGS}")
 
 MARK_AS_ADVANCED (LIB_TEMP)
 MARK_AS_ADVANCED (HEADER_TEMP)



More information about the Openvas-commits mailing list