Commit 48fb8083 authored by Ralf Habacker's avatar Ralf Habacker Committed by Simon McVittie

Uses cmake provided expat find package.

The cmake provided expat find package is more up to date.
There is no need to maintain an additional one.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733Reviewed-by: 's avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 161b7d70
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
# we do not need to have WIN32 defined
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
......@@ -9,8 +12,6 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
# detect version
include(MacrosAutotools)
......@@ -98,7 +99,7 @@ option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
if (DBUS_USE_EXPAT)
find_package(LibExpat)
find_package(EXPAT)
else ()
find_package(LibXml2)
endif ()
......@@ -298,14 +299,14 @@ if("${sysname}" MATCHES ".*SOLARIS.*")
endif("${sysname}" MATCHES ".*SOLARIS.*")
#AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[libxml/expat]],[XML library to use]))
if(NOT LIBXML2_FOUND AND NOT LIBEXPAT_FOUND)
if(NOT LIBXML2_FOUND AND NOT EXPAT_FOUND)
message(FATAL "Neither expat nor libxml2 found!")
endif(NOT LIBXML2_FOUND AND NOT LIBEXPAT_FOUND)
endif(NOT LIBXML2_FOUND AND NOT EXPAT_FOUND)
if(DBUS_USE_EXPAT)
SET(XML_LIB "Expat")
SET(XML_LIBRARY ${LIBEXPAT_LIBRARIES})
SET(XML_INCLUDE_DIR ${LIBEXPAT_INCLUDE_DIR})
SET(XML_LIBRARY ${EXPAT_LIBRARIES})
SET(XML_INCLUDE_DIR ${EXPAT_INCLUDE_DIR})
else(DBUS_USE_EXPAT)
SET(XML_LIB "LibXML2")
SET(XML_LIBRARY ${LIBXML2_LIBRARIES})
......
# - Try to find LIBEXPAT
# Once done this will define
#
# LIBEXPAT_FOUND - system has LIBEXPAT
# LIBEXPAT_INCLUDE_DIR - the LIBEXPAT include directory
# LIBEXPAT_LIBRARIES - the libraries needed to use LIBEXPAT
# LIBEXPAT_DEFINITIONS - Compiler switches required for using LIBEXPAT
if (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
# in cache already
SET(LIBEXPAT_FOUND TRUE)
else (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
IF (WIN32)
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
find_FILE(LIBEXPAT_DIR expat Source/lib/expat.h
PATHS
"${_progFiles}"
)
if (LIBEXPAT_DIR)
set (_LIBEXPATIncDir ${LIBEXPAT_DIR}/Source/lib)
set (_LIBEXPATLinkDir ${LIBEXPAT_DIR}/libs)
endif (LIBEXPAT_DIR)
ELSE (WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(UsePkgConfig)
PKGCONFIG(LIBEXPAT-2.0 _LIBEXPATIncDir _LIBEXPATLinkDir _LIBEXPATLinkFlags _LiIconvCflags)
SET(LIBEXPAT_DEFINITIONS ${_LIBEXPATCflags})
ENDIF (WIN32)
FIND_PATH(LIBEXPAT_INCLUDE_DIR expat.h
PATHS
${_LIBEXPATIncDir}
PATH_SUFFIXES LIBEXPAT
)
FIND_LIBRARY(LIBEXPAT_LIBRARIES NAMES expat libexpat
PATHS
${_LIBEXPATLinkDir}
)
if (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
set(LIBEXPAT_FOUND TRUE)
endif (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
if (LIBEXPAT_FOUND)
if (NOT LIBEXPAT_FIND_QUIETLY)
message(STATUS "Found libexpat: ${LIBEXPAT_LIBRARIES}")
endif (NOT LIBEXPAT_FIND_QUIETLY)
else (LIBEXPAT_FOUND)
if (LIBEXPAT_FIND_REQUIRED)
message(SEND_ERROR "Could NOT find libexpat")
endif (LIBEXPAT_FIND_REQUIRED)
endif (LIBEXPAT_FOUND)
MARK_AS_ADVANCED(LIBEXPAT_INCLUDE_DIR LIBEXPAT_LIBRARIES)
endif (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment