diff options
author | Chaoren Lin <aoe@google.com> | 2016-07-12 11:53:58 -0700 |
---|---|---|
committer | Chaoren Lin <chaorenl@google.com> | 2016-07-22 23:31:32 +0000 |
commit | ee96b2ec399702e23faee15863fed3ae33144fdd (patch) | |
tree | 8ad8b5881235f6e813451e8916201104d8155bd5 /share/cmake-3.6/Modules/FindBacktrace.cmake | |
parent | 091caafda44f7fe52a94387b2eafcf204ea909d3 (diff) | |
download | linux-x86-ee96b2ec399702e23faee15863fed3ae33144fdd.tar.gz |
Update prebuilts to CMake 3.6.0-rc2 (go/ab/3043163).ndk-r16-beta2ndk-r16-beta1ndk-r16ndk-r15-beta2ndk-r15-beta1ndk-r14-beta2ndk-r14-beta1ndk-r14ndk-r13-beta2ndk-r13ndk-release-r16ndk-r16-releasendk-r15-releasendk-r14-releasendk-r13-release
Change-Id: Ibe6715663df09f1d9ac5fcb588e12c657b2caab1
(cherry picked from commit ecf0ec027d28d2c26ce13075003dc57db20d279e)
Diffstat (limited to 'share/cmake-3.6/Modules/FindBacktrace.cmake')
-rw-r--r-- | share/cmake-3.6/Modules/FindBacktrace.cmake | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/share/cmake-3.6/Modules/FindBacktrace.cmake b/share/cmake-3.6/Modules/FindBacktrace.cmake new file mode 100644 index 0000000..cb4f60a --- /dev/null +++ b/share/cmake-3.6/Modules/FindBacktrace.cmake @@ -0,0 +1,101 @@ +#.rst: +# FindBacktrace +# ------------- +# +# Find provider for backtrace(3). +# +# Checks if OS supports backtrace(3) via either libc or custom library. +# This module defines the following variables: +# +# ``Backtrace_HEADER`` +# The header file needed for backtrace(3). Cached. +# Could be forcibly set by user. +# ``Backtrace_INCLUDE_DIRS`` +# The include directories needed to use backtrace(3) header. +# ``Backtrace_LIBRARIES`` +# The libraries (linker flags) needed to use backtrace(3), if any. +# ``Backtrace_FOUND`` +# Is set if and only if backtrace(3) support detected. +# +# The following cache variables are also available to set or use: +# +# ``Backtrace_LIBRARY`` +# The external library providing backtrace, if any. +# ``Backtrace_INCLUDE_DIR`` +# The directory holding the backtrace(3) header. +# +# Typical usage is to generate of header file using configure_file() with the +# contents like the following:: +# +# #cmakedefine01 Backtrace_FOUND +# #if Backtrace_FOUND +# # include <${Backtrace_HEADER}> +# #endif +# +# And then reference that generated header file in actual source. + +#============================================================================= +# Copyright 2013 Vadim Zhukov +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +include(CMakePushCheckState) +include(CheckSymbolExists) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +# List of variables to be provided to find_package_handle_standard_args() +set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR) + +if(Backtrace_HEADER) + set(_Backtrace_HEADER_TRY "${Backtrace_HEADER}") +else(Backtrace_HEADER) + set(_Backtrace_HEADER_TRY "execinfo.h") +endif(Backtrace_HEADER) + +find_path(Backtrace_INCLUDE_DIR "${_Backtrace_HEADER_TRY}") +set(Backtrace_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR}) + +if (NOT DEFINED Backtrace_LIBRARY) + # First, check if we already have backtrace(), e.g., in libc + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY}) + check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND) + cmake_pop_check_state() +endif() + +if(_Backtrace_SYM_FOUND) + # Avoid repeating the message() call below each time CMake is run. + if(NOT Backtrace_FIND_QUIETLY AND NOT DEFINED Backtrace_LIBRARY) + message(STATUS "backtrace facility detected in default set of libraries") + endif() + set(Backtrace_LIBRARY "" CACHE FILEPATH "Library providing backtrace(3), empty for default set of libraries") +else() + # Check for external library, for non-glibc systems + if(Backtrace_INCLUDE_DIR) + # OpenBSD has libbacktrace renamed to libexecinfo + find_library(Backtrace_LIBRARY "execinfo") + elseif() # respect user wishes + set(_Backtrace_HEADER_TRY "backtrace.h") + find_path(Backtrace_INCLUDE_DIR ${_Backtrace_HEADER_TRY}) + find_library(Backtrace_LIBRARY "backtrace") + endif() + + # Prepend list with library path as it's more common practice + set(_Backtrace_STD_ARGS Backtrace_LIBRARY ${_Backtrace_STD_ARGS}) +endif() + +set(Backtrace_LIBRARIES ${Backtrace_LIBRARY}) +set(Backtrace_HEADER "${_Backtrace_HEADER_TRY}" CACHE STRING "Header providing backtrace(3) facility") + +find_package_handle_standard_args(Backtrace FOUND_VAR Backtrace_FOUND REQUIRED_VARS ${_Backtrace_STD_ARGS}) +mark_as_advanced(Backtrace_HEADER Backtrace_INCLUDE_DIR Backtrace_LIBRARY) |