1 # - Try to find LibWPG
2 # Once done this will define
3 #
4 # LIBWPG_FOUND - system has LibWPG
5 # LIBWPG_INCLUDE_DIRS - the LibWPG include directory
6 # LIBWPG_LIBRARIES - Link these to use LibWPG
7 # LIBWPG_DEFINITIONS - Compiler switches required for using LibWPG
8 #
9 # Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
10 #
11 # Redistribution and use is allowed according to the terms of the New
12 # BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14 #
17 if (LIBWPG_LIBRARIES AND LIBWPG_INCLUDE_DIRS)
18 # in cache already
19 set(LIBWPG_FOUND TRUE)
20 else (LIBWPG_LIBRARIES AND LIBWPG_INCLUDE_DIRS)
21 # use pkg-config to get the directories and then use these values
22 # in the FIND_PATH() and FIND_LIBRARY() calls
23 if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
24 include(UsePkgConfig)
25 pkgconfig(libwpg-0.1 _LIBWPG_INCLUDEDIR _LIBWPG_LIBDIR _LIBWPG_LDFLAGS _LIBWPG_CFLAGS)
26 else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
27 find_package(PkgConfig)
28 if (PKG_CONFIG_FOUND)
29 pkg_check_modules(_LIBWPG libwpg-0.1)
30 endif (PKG_CONFIG_FOUND)
31 endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
32 find_path(LIBWPG_INCLUDE_DIR
33 NAMES
34 libwpg/libwpg.h
35 PATHS
36 ${_LIBWPG_INCLUDEDIR}
37 /usr/include
38 /usr/local/include
39 /opt/local/include
40 /sw/include
41 PATH_SUFFIXES
42 libwpg-0.1
43 )
45 find_library(LIBWPG-0.1_LIBRARY
46 NAMES
47 wpg-0.1
48 PATHS
49 ${_LIBWPG_LIBDIR}
50 /usr/lib
51 /usr/local/lib
52 /opt/local/lib
53 /sw/lib
54 )
56 if (LIBWPG-0.1_LIBRARY)
57 set(LIBWPG-0.1_FOUND TRUE)
58 endif (LIBWPG-0.1_LIBRARY)
60 set(LIBWPG_INCLUDE_DIRS
61 ${LIBWPG_INCLUDE_DIR}
62 )
64 if (LIBWPG-0.1_FOUND)
65 set(LIBWPG_LIBRARIES
66 ${LIBWPG_LIBRARIES}
67 ${LIBWPG-0.1_LIBRARY}
68 )
69 endif (LIBWPG-0.1_FOUND)
71 if (LIBWPG_INCLUDE_DIRS AND LIBWPG_LIBRARIES)
72 set(LIBWPG_FOUND TRUE)
73 endif (LIBWPG_INCLUDE_DIRS AND LIBWPG_LIBRARIES)
75 if (LIBWPG_FOUND)
76 if (NOT LibWPG_FIND_QUIETLY)
77 message(STATUS "Found LibWPG: ${LIBWPG_LIBRARIES}")
78 endif (NOT LibWPG_FIND_QUIETLY)
79 else (LIBWPG_FOUND)
80 if (LibWPG_FIND_REQUIRED)
81 message(FATAL_ERROR "Could not find LibWPG")
82 endif (LibWPG_FIND_REQUIRED)
83 endif (LIBWPG_FOUND)
85 # show the LIBWPG_INCLUDE_DIRS and LIBWPG_LIBRARIES variables only in the advanced view
86 mark_as_advanced(LIBWPG_INCLUDE_DIRS LIBWPG_LIBRARIES)
88 endif (LIBWPG_LIBRARIES AND LIBWPG_INCLUDE_DIRS)