Sync FindBacktrace.cmake with what's been committed upstream and what's the

Clementine actually waits for.

Pointed out, initially patched and tested by sthen@, thanks!
This commit is contained in:
zhuk 2014-06-25 00:29:45 +00:00
parent 247716f6e1
commit d5512af05c
3 changed files with 56 additions and 37 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.11 2014/03/10 20:28:41 landry Exp $
# $OpenBSD: Makefile,v 1.12 2014/06/25 00:29:45 zhuk Exp $
SHARED_ONLY = Yes
COMMENT = Qt4-based featureful music player
DISTNAME = clementine-1.2.1
REVISION = 1
REVISION = 2
CATEGORIES = audio x11
HOMEPAGE = http://clementine-player.org/

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.101 2014/05/13 05:55:30 dcoppa Exp $
# $OpenBSD: Makefile,v 1.102 2014/06/25 00:29:45 zhuk Exp $
DPB_PROPERTIES =parallel
@ -11,7 +11,7 @@ HOMEPAGE = http://www.cmake.org/
CATEGORIES = devel
COMMENT = portable build system
DISTNAME = cmake-2.8.12.2
REVISION = 3
REVISION = 4
MASTER_SITES = ${HOMEPAGE}files/v2.8/
MAINTAINER = David Coppa <dcoppa@openbsd.org>

View File

@ -1,12 +1,25 @@
# - 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 - header file needed for backtrace(3)
# BACKTRACE_INCLUDE_DIR - where to find ${BACKTRACE_HEADER}
# BACKTRACE_LIBRARIES - libraries needed for backtrace
# BACKTRACE_FOUND - is set if and only if backtrace(3) support detected
# 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 (c) 2013, Vadim Zhukov <persgray@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
@ -27,39 +40,45 @@ include(CheckSymbolExists)
include(FindPackageHandleStandardArgs)
# List of variables to be provided to find_package_handle_standard_args()
set(_BACKTRACE_STD_ARGS BACKTRACE_INCLUDE_DIR)
set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR)
set(BACKTRACE_HEADER "execinfo.h")
find_path(BACKTRACE_INCLUDE_DIR ${BACKTRACE_HEADER})
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})
# First, check if we already have backtrace(), e.g., in libc
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${BACKTRACE_INCLUDE_DIR})
check_symbol_exists("backtrace" "execinfo.h" _BACKTRACE_SYM_FOUND)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
cmake_pop_check_state()
if(_BACKTRACE_SYM_FOUND)
# Warning: CMAKE_REQUIRED_LIBRARIES could contain non-paths, so
# don't add BACKTRACE_LIBRARIES to standard args list in this case.
set(BACKTRACE_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
if(NOT BACKTRACE_FIND_QUIETLY)
message("backtrace detected in default set of libraries: "
${BACKTRACE_LIBRARIES})
endif(NOT BACKTRACE_FIND_QUIETLY)
else(_BACKTRACE_SYM_FOUND)
# Check for external library, for non-glibc systems
if(BACKTRACE_INCLUDE_DIR)
# OpenBSD has libbacktrace renamed to libexecinfo
find_library(BACKTRACE_LIBRARIES "execinfo")
else(BACKTRACE_INCLUDE_DIR)
set(BACKTRACE_HEADER "backtrace.h")
find_path(BACKTRACE_INCLUDE_DIR ${BACKTRACE_HEADER})
find_library(BACKTRACE_LIBRARIES "backtrace")
endif(BACKTRACE_INCLUDE_DIR)
if(_Backtrace_SYM_FOUND)
set(Backtrace_LIBRARY)
if(NOT Backtrace_FIND_QUIETLY)
message(STATUS "backtrace facility detected in default set of libraries")
endif()
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_LIBRARIES ${_BACKTRACE_STD_ARGS})
endif(_BACKTRACE_SYM_FOUND)
# Prepend list with library path as it's more common practice
set(_Backtrace_STD_ARGS Backtrace_LIBRARY ${_Backtrace_STD_ARGS})
endif()
find_package_handle_standard_args(backtrace DEFAULT_MSG ${_BACKTRACE_STD_ARGS})
mark_as_advanced(BACKTRACE_HEADER BACKTRACE_INCLUDE_DIR BACKTRACE_LIBRARIES)
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)