aboutsummaryrefslogtreecommitdiff
path: root/modules/FindLibXml2.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2006-01-22 10:29:20 +0000
committerAlexander Neundorf <neundorf@kde.org>2006-01-22 10:29:20 +0000
commit7c7a0e07ca201f1f5dd51bf87d6c023dc9dc28f0 (patch)
tree24a7fc6a27bc61b32ef736d2412508ada7e683d0 /modules/FindLibXml2.cmake
parenta6f951a920cc9b57aa36285d1201f7ebf0ad0265 (diff)
downloadextra-cmake-modules-7c7a0e07ca201f1f5dd51bf87d6c023dc9dc28f0.tar.gz
extra-cmake-modules-7c7a0e07ca201f1f5dd51bf87d6c023dc9dc28f0.tar.bz2
-generate_findpackage_file: a script to simplify generating simple FindFoo.cmake files
-FindLibXml2.cmake and FindLibXslt.cmake: modules to find libxml2 and libxslt, generated by the script above -some tuning in the other modules Alex svn path=/trunk/KDE/kdesdk/cmake/; revision=501125
Diffstat (limited to 'modules/FindLibXml2.cmake')
-rw-r--r--modules/FindLibXml2.cmake45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/FindLibXml2.cmake b/modules/FindLibXml2.cmake
new file mode 100644
index 00000000..37486afc
--- /dev/null
+++ b/modules/FindLibXml2.cmake
@@ -0,0 +1,45 @@
+# - Try to find LibXml2
+# Once done this will define
+#
+# LIBXML2_FOUND - system has LibXml2
+# LIBXML2_INCLUDE_DIR - the LibXml2 include directory
+# LIBXML2_LIBRARY - Link these to use OpenGL and GLU
+# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
+#
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+
+
+INCLUDE(UsePkgConfig)
+
+PKGCONFIG(libxml-2.0 _LibXml2IncDir _LibXml2LinkDir _LibXml2LinkFlags _LibXml2Cflags)
+
+SET(LIBXML2_DEFINITIONS ${_LibXml2Cflags})
+
+FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
+ ${_LibXml2IncDir}/libxml2
+ /usr/include/libxml2
+ /usr/local/include/libxml2
+)
+
+FIND_LIBRARY(LIBXML2_LIBRARY NAMES xml2
+ PATHS
+ ${_LibXml2LinkDir}
+ /usr/lib
+ /usr/local/lib
+)
+
+IF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARY)
+ SET(LIBXML2_FOUND TRUE)
+ENDIF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARY)
+
+IF(LIBXML2_FOUND)
+ IF(NOT LIBXML2_QUIETLY)
+ MESSAGE(STATUS "Found LibXml2: ${LIBXML2_LIBRARY}")
+ ENDIF(NOT LIBXML2_QUIETLY)
+ELSE(LIBXML2_FOUND)
+ IF(NOT LIBXML2_REQUIRED)
+ MESSAGE(SEND_ERROR "Could not find LibXml2")
+ ENDIF(NOT LIBXML2_REQUIRED)
+ENDIF(LIBXML2_FOUND)
+