2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# FindEXPAT
|
|
|
|
# ---------
|
|
|
|
#
|
|
|
|
# Find expat
|
|
|
|
#
|
2006-10-19 20:57:28 +04:00
|
|
|
# Find the native EXPAT headers and libraries.
|
|
|
|
#
|
2013-10-15 19:17:36 +04:00
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# EXPAT_INCLUDE_DIRS - where to find expat.h, etc.
|
|
|
|
# EXPAT_LIBRARIES - List of libraries when using expat.
|
|
|
|
# EXPAT_FOUND - True if expat found.
|
2006-10-19 20:57:28 +04:00
|
|
|
|
2009-09-28 19:45:50 +04:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2006-2009 Kitware, Inc.
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:45:50 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2006-10-19 20:57:28 +04:00
|
|
|
# Look for the header file.
|
2012-08-13 21:47:32 +04:00
|
|
|
find_path(EXPAT_INCLUDE_DIR NAMES expat.h)
|
2006-10-19 20:57:28 +04:00
|
|
|
|
|
|
|
# Look for the library.
|
2012-08-13 21:47:32 +04:00
|
|
|
find_library(EXPAT_LIBRARY NAMES expat libexpat)
|
2007-07-19 17:00:51 +04:00
|
|
|
|
2012-01-23 23:53:22 +04:00
|
|
|
if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
|
|
|
|
file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str
|
|
|
|
REGEX "^#[\t ]*define[\t ]+XML_(MAJOR|MINOR|MICRO)_VERSION[\t ]+[0-9]+$")
|
|
|
|
|
|
|
|
unset(EXPAT_VERSION_STRING)
|
|
|
|
foreach(VPART MAJOR MINOR MICRO)
|
|
|
|
foreach(VLINE ${expat_version_str})
|
2014-04-06 23:30:00 +04:00
|
|
|
if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$")
|
|
|
|
set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}")
|
2012-01-23 23:53:22 +04:00
|
|
|
if(EXPAT_VERSION_STRING)
|
2016-07-28 01:41:13 +03:00
|
|
|
string(APPEND EXPAT_VERSION_STRING ".${EXPAT_VERSION_PART}")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-01-23 23:53:22 +04:00
|
|
|
set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-01-23 23:53:22 +04:00
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
|
|
|
endforeach()
|
|
|
|
endif ()
|
2012-01-23 23:53:22 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
|
2007-07-19 17:00:51 +04:00
|
|
|
# all listed variables are TRUE
|
2012-08-13 21:47:32 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2012-01-23 23:53:22 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT
|
|
|
|
REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR
|
|
|
|
VERSION_VAR EXPAT_VERSION_STRING)
|
2006-10-19 20:57:28 +04:00
|
|
|
|
|
|
|
# Copy the results to the output variables.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(EXPAT_FOUND)
|
|
|
|
set(EXPAT_LIBRARIES ${EXPAT_LIBRARY})
|
|
|
|
set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-10-19 20:57:28 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY)
|