File: FindLibexecinfo.cmake

package info (click to toggle)
qtcurve 1.9-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,460 kB
  • sloc: cpp: 70,269; perl: 123; sh: 122; xml: 46; makefile: 15
file content (48 lines) | stat: -rw-r--r-- 1,757 bytes parent folder | download | duplicates (5)
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
# Try to find LibExecinfo functionality
# Once done this will define
#
#  LIBEXECINFO_FOUND - system has LibExecinfo
#  LIBEXECINFO_INCLUDE_DIR - LibExecinfo include directory
#  LIBEXECINFO_LIBRARIES - Libraries needed to use LibExecinfo
#
# TODO: This will enable translations only if Gettext functionality is
# present in libc. Must have more robust system for release, where Gettext
# functionality can also reside in standalone Gettext library, or the one
# embedded within kdelibs (cf. gettext.m4 from Gettext source).

# Copyright (c) 2006, Chusslove Illich, <caslav.ilic@gmx.net>
# Copyright (c) 2007, Alexander Neundorf, <neundorf@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(LIBEXECINFO_INCLUDE_DIR AND LIBEXECINFO_LIB_FOUND)
  set(LibExecinfo_FIND_QUIETLY TRUE)
endif()

unset(LIBEXECINFO_INCLUDE_DIR CACHE)
find_path(LIBEXECINFO_INCLUDE_DIR execinfo.h)

set(LIBEXECINFO_LIB_FOUND FALSE)

if(LIBEXECINFO_INCLUDE_DIR)
  include(CheckFunctionExists)
  check_function_exists(backtrace LIBEXECINFO_LIBC_HAS_LIBEXECINFO_BACKTRACE)

  if(LIBEXECINFO_LIBC_HAS_LIBEXECINFO_BACKTRACE)
    set(LIBEXECINFO_LIBRARIES)
    set(LIBEXECINFO_LIB_FOUND TRUE)
  else()
    unset(LIBEXECINFO_LIBRARIES CACHE)
    find_library(LIBEXECINFO_LIBRARIES NAMES execinfo libexecinfo)
    if(LIBEXECINFO_LIBRARIES)
      set(LIBEXECINFO_LIB_FOUND TRUE)
    endif()
  endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibExecinfo
  DEFAULT_MSG LIBEXECINFO_INCLUDE_DIR LIBEXECINFO_LIB_FOUND)
mark_as_advanced(LIBEXECINFO_INCLUDE_DIR LIBEXECINFO_LIBRARIES
  LIBEXECINFO_LIBC_HAS_LIBEXECINFO_BACKTRACE LIBEXECINFO_LIB_FOUND)