File: FindLibSpectre.cmake

package info (click to toggle)
cantor 4%3A20.12.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,572 kB
  • sloc: cpp: 41,602; ansic: 5,802; pascal: 1,027; xml: 371; sh: 289; makefile: 207; lisp: 91; python: 24
file content (59 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (3)
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
55
56
57
58
59
# - Try to find the libspectre PS library
# Once done this will define
#
#  LIBSPECTRE_FOUND - system has libspectre
#  LIBSPECTRE_INCLUDE_DIR - the libspectre include directory
#  LIBSPECTRE_LIBRARY - Link this to use libspectre
#

# Copyright (c) 2006-2007, Pino Toscano, <pino@kde.org>
# Copyright (c) 2008, Albert Astals Cid, <aacid@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)

  # in cache already
  set(LIBSPECTRE_FOUND TRUE)

else(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)

if(NOT WIN32)
  # use pkg-config to get the directories and then use these values
  # in the FIND_PATH() and FIND_LIBRARY() calls
  include(FindPkgConfig)

  if(LIBSPECTRE_MINIMUM_VERSION})
    pkg_check_modules(_pc_LIBSPECTRE libspectre>=${LIBSPECTRE_MINIMUM_VERSION})
  else(LIBSPECTRE_MINIMUM_VERSION})
    pkg_check_modules(_pc_LIBSPECTRE libspectre)
  endif(LIBSPECTRE_MINIMUM_VERSION})
else(NOT WIN32)
  # do not use pkg-config on windows
  set(_pc_LIBSPECTRE_FOUND TRUE)
endif(NOT WIN32)


if(_pc_LIBSPECTRE_FOUND)
  find_library(LIBSPECTRE_LIBRARY
    NAMES libspectre spectre
    HINTS ${_pc_LIBSPECTRE_LIBRARY_DIRS} ${CMAKE_LIBRARY_PATH}
  )

  find_path(LIBSPECTRE_INCLUDE_DIR spectre.h
    HINTS ${_pc_LIBSPECTRE_INCLUDE_DIRS}
    PATH_SUFFIXES libspectre
  )

  set(LIBSPECTRE_FOUND TRUE)
endif(_pc_LIBSPECTRE_FOUND)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibSpectre DEFAULT_MSG LIBSPECTRE_LIBRARY)

# ensure that they are cached
set(LIBSPECTRE_INCLUDE_DIR ${LIBSPECTRE_INCLUDE_DIR} CACHE INTERNAL "The libspectre include path")
set(LIBSPECTRE_LIBRARY ${LIBSPECTRE_LIBRARY} CACHE INTERNAL "The libspectre library")

endif(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)