PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/CMakeModules/FindLibAttica.cmake

http://github.com/tomahawk-player/tomahawk
CMake | 63 lines | 34 code | 11 blank | 18 comment | 0 complexity | bc17811c868d1660f21ffb44975b427e MD5 | raw file
 1# Try to find the Attica library
 2# Once done this will define
 3#
 4#   LIBATTICA_FOUND          Indicates that Attica was found
 5#   LIBATTICA_LIBRARIES      Libraries needed to use Attica
 6#   LIBATTICA_LIBRARY_DIRS   Paths needed for linking against Attica
 7#   LIBATTICA_INCLUDE_DIR    Path needed for finding Attica include files
 8#
 9# The minimum required version of LibAttica can be specified using the
10# standard syntax, e.g. find_package(LibAttica 0.20)
11
12# Copyright (c) 2009 Frederik Gladhorn <gladhorn@kde.org>
13#
14# Redistribution and use is allowed according to the terms of the BSD license.
15
16# Support LIBATTICA_MIN_VERSION for compatibility:
17IF(NOT LibAttica_FIND_VERSION)
18  SET(LibAttica_FIND_VERSION "${LIBATTICA_MIN_VERSION}")
19ENDIF(NOT LibAttica_FIND_VERSION)
20
21# the minimum version of LibAttica we require
22IF(NOT LibAttica_FIND_VERSION)
23  SET(LibAttica_FIND_VERSION "0.1.0")
24ENDIF(NOT LibAttica_FIND_VERSION)
25
26
27IF (NOT WIN32)
28   # use pkg-config to get the directories and then use these values
29   # in the FIND_PATH() and FIND_LIBRARY() calls
30   FIND_PACKAGE(PkgConfig)
31   PKG_CHECK_MODULES(PC_LIBATTICA QUIET libattica)
32   SET(LIBATTICA_DEFINITIONS ${PC_ATTICA_CFLAGS_OTHER})
33ENDIF (NOT WIN32)
34
35FIND_PATH(LIBATTICA_INCLUDE_DIR attica/provider.h
36   HINTS
37   ${PC_LIBATTICA_INCLUDEDIR}
38   ${PC_LIBATTICA_INCLUDE_DIRS}
39   PATH_SUFFIXES attica
40   )
41
42# Store the version number in the cache, so we don't have to search everytime:
43IF(LIBATTICA_INCLUDE_DIR  AND NOT  LIBATTICA_VERSION)
44  FILE(READ ${LIBATTICA_INCLUDE_DIR}/attica/version.h LIBATTICA_VERSION_CONTENT)
45  STRING (REGEX MATCH "LIBATTICA_VERSION_STRING \".*\"\n" LIBATTICA_VERSION_MATCH "${LIBATTICA_VERSION_CONTENT}")
46  IF(LIBATTICA_VERSION_MATCH)
47    STRING(REGEX REPLACE "LIBATTICA_VERSION_STRING \"(.*)\"\n" "\\1" _LIBATTICA_VERSION ${LIBATTICA_VERSION_MATCH})
48  ENDIF(LIBATTICA_VERSION_MATCH)
49  SET(LIBATTICA_VERSION "${_LIBATTICA_VERSION}" CACHE STRING "Version number of LibAttica" FORCE)
50ENDIF(LIBATTICA_INCLUDE_DIR  AND NOT  LIBATTICA_VERSION)
51
52
53FIND_LIBRARY(LIBATTICA_LIBRARIES NAMES attica libattica
54   HINTS
55   ${PC_LIBATTICA_LIBDIR}
56   ${PC_LIBATTICA_LIBRARY_DIRS}
57   )
58
59INCLUDE(FindPackageHandleStandardArgs)
60FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibAttica  REQUIRED_VARS LIBATTICA_LIBRARIES LIBATTICA_INCLUDE_DIR
61                                             VERSION_VAR LIBATTICA_VERSION)
62
63MARK_AS_ADVANCED(LIBATTICA_INCLUDE_DIR LIBATTICA_LIBRARIES)