summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindGLIB2.cmake51
-rw-r--r--cmake/modules/FindLibXml2.cmake57
2 files changed, 108 insertions, 0 deletions
diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake
new file mode 100644
index 0000000..226d551
--- /dev/null
+++ b/cmake/modules/FindGLIB2.cmake
@@ -0,0 +1,51 @@
1# - Try to find the GLIB2 libraries
2# Once done this will define
3#
4# GLIB2_FOUND - system has glib2
5# GLIB2_INCLUDE_DIR - the glib2 include directory
6# GLIB2_LIBRARIES - glib2 library
7
8# Copyright (c) 2008 Laurent Montel, <montel@kde.org>
9#
10# Redistribution and use is allowed according to the terms of the BSD license.
11# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12
13
14if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
15 # Already in cache, be silent
16 set(GLIB2_FIND_QUIETLY TRUE)
17endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
18
19if (NOT WIN32)
20 FIND_PACKAGE(PkgConfig)
21 PKG_CHECK_MODULES(PC_GLIB2 glib-2.0)
22 SET(GLIB2_DEFINITIONS ${PC_GLIB2_CFLAGS_OTHER})
23endif(NOT WIN32)
24
25find_path(GLIB2_MAIN_INCLUDE_DIR glib.h
26 PATH_SUFFIXES glib-2.0
27 PATHS ${_LibGLIB2IncDir} )
28
29# search the glibconfig.h include dir under the same root where the library is found
30find_library(GLIB2_LIBRARIES
31 NAMES glib-2.0
32 PATHS ${_LibGLIB2LinkDir} )
33
34get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH)
35
36find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
37 PATH_SUFFIXES glib-2.0/include
38 PATHS ${_LibGLIB2IncDir} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH})
39
40set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}")
41
42# not sure if this include dir is optional or required
43# for now it is optional
44if(GLIB2_INTERNAL_INCLUDE_DIR)
45 set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}")
46endif(GLIB2_INTERNAL_INCLUDE_DIR)
47
48include(FindPackageHandleStandardArgs)
49find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
50
51mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES) \ No newline at end of file
diff --git a/cmake/modules/FindLibXml2.cmake b/cmake/modules/FindLibXml2.cmake
new file mode 100644
index 0000000..8d3c77e
--- /dev/null
+++ b/cmake/modules/FindLibXml2.cmake
@@ -0,0 +1,57 @@
1# - Try to find LibXml2
2# Once done this will define
3#
4# LIBXML2_FOUND - System has LibXml2
5# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
6# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
7# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
8# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
9
10# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
11#
12# Redistribution and use is allowed according to the terms of the BSD license.
13# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14
15
16IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
17 # in cache already
18 SET(LibXml2_FIND_QUIETLY TRUE)
19ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
20
21IF (NOT WIN32)
22 # use pkg-config to get the directories and then use these values
23 # in the FIND_PATH() and FIND_LIBRARY() calls
24 FIND_PACKAGE(PkgConfig)
25 PKG_CHECK_MODULES(PC_LIBXML libxml-2.0)
26 SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
27ENDIF (NOT WIN32)
28
29FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
30 HINTS
31 ${PC_LIBXML_INCLUDEDIR}
32 ${PC_LIBXML_INCLUDE_DIRS}
33 PATH_SUFFIXES libxml2
34 )
35
36FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
37 HINTS
38 ${PC_LIBXML_LIBDIR}
39 ${PC_LIBXML_LIBRARY_DIRS}
40 )
41
42FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
43# for backwards compat. with KDE 4.0.x:
44SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
45
46IF( NOT LIBXML2_XMLLINT_EXECUTABLE )
47 MESSAGE(STATUS "xmllint program not found. Install it if you want validate generated doc file.")
48ENDIF(NOT LIBXML2_XMLLINT_EXECUTABLE )
49
50
51INCLUDE(FindPackageHandleStandardArgs)
52
53# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
54# all listed variables are TRUE
55FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
56
57MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)