FindLibXML2.cmake
1.13 KB
# - Try to find LibXml2
# Once done this will define
# LIBXML2_FOUND - System has LibXml2
# LIBXML2_INCLUDE_DIRS - The LibXml2 include directories
# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xinclude.h PATHS ${USERLOCAL_ROOT}/include/libxml2)
FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 PATHS ${USERLOCAL_ROOT}/lib NO_DEFAULT_PATH)
IF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
SET(LibXML2_FOUND 1)
#remove last /libxml2 string
STRING(REGEX REPLACE "/libxml2" "" LIBXML2_INCLUDE_DIR_SUP_LEVEL ${LIBXML2_INCLUDE_DIR})
SET (LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIR_SUP_LEVEL} ${LIBXML2_INCLUDE_DIR} )
if(NOT LibXML2_FIND_QUIETLY)
message(STATUS "Found libXML2: ${LIBXML2_LIBRARIES}")
endif(NOT LibXML2_FIND_QUIETLY)
ELSE(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
SET(LibXML2_FOUND 0 CACHE BOOL "Not found libxml2 library")
message(STATUS "NOT Found libxml2, disabling it")
ENDIF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES)