File: FindExpat.cmake

package info (click to toggle)
fcitx5 5.1.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32,228 kB
  • sloc: cpp: 110,377; java: 3,125; javascript: 2,137; sh: 1,912; xml: 1,552; python: 1,312; ansic: 843; makefile: 11
file content (54 lines) | stat: -rw-r--r-- 1,542 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#.rst:
# FindExpat
# -----------
#
# Try to find the Expat xml processing library
#
# Once done this will define
#
# ::
#
#   EXPAT_FOUND - System has Expat
#   EXPAT_INCLUDE_DIR - The Expat include directory
#   EXPAT_LIBRARIES - The libraries needed to use Expat
#   EXPAT_DEFINITIONS - Compiler switches required for using Expat
#   EXPAT_VERSION_STRING - the version of Expat found (since CMake 2.8.8)

# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_EXPAT QUIET expat)

find_path(EXPAT_INCLUDE_DIR NAMES expat.h
   HINTS
   ${PC_EXPAT_INCLUDEDIR}
   ${PC_EXPAT_INCLUDE_DIRS}
   )

find_library(EXPAT_LIBRARIES NAMES expat
   HINTS
   ${PC_EXPAT_LIBDIR}
   ${PC_EXPAT_LIBRARY_DIRS}
   )

if(PC_EXPAT_VERSION)
    set(EXPAT_VERSION_STRING ${PC_EXPAT_VERSION})
endif()

# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Expat
                                  REQUIRED_VARS EXPAT_LIBRARIES EXPAT_INCLUDE_DIR
                                  VERSION_VAR EXPAT_VERSION_STRING)

mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARIES)

if (EXPAT_FOUND AND NOT TARGET Expat::Expat)
    add_library(Expat::Expat UNKNOWN IMPORTED)
    set_target_properties(Expat::Expat PROPERTIES
        IMPORTED_LOCATION "${EXPAT_LIBRARIES}"
        INTERFACE_INCLUDE_DIRECTORIES "${EXPAT_INCLUDE_DIR}"
    )
endif()