Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10391 from ceph/wip-cmake
cmake changes Reviewed-by: Ali Maredia <amaredia@redhat.com>
- Loading branch information
Showing
17 changed files
with
216 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(FindPackageHandleStandardArgs) | ||
|
||
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,22 @@ | ||
# - Find OpenLDAP C Libraries | ||
# | ||
# OPENLDAP_PREFIX - where to find ldap.h and libraries | ||
# OPENLDAP_FOUND - True if found. | ||
# OPENLDAP_INCLUDE_DIR - Path to the openldap include directory | ||
# OPENLDAP_LIBRARIES - Paths to the ldap and lber libraries | ||
|
||
set(OPENLDAP_LIB_DIR "${OPENLDAP_PREFIX}/lib") | ||
|
||
find_path(OPENLDAP_INCLUDE_DIR ldap.h NO_DEFAULT_PATH PATHS | ||
find_path(OPENLDAP_INCLUDE_DIR ldap.h PATHS | ||
/usr/include | ||
/opt/local/include | ||
/usr/local/include | ||
"${OPENLDAP_PREFIX}/include" | ||
) | ||
|
||
find_library(LIBLDAP NAMES ldap) | ||
find_library(LIBLBER NAMES lber) | ||
/usr/local/include) | ||
|
||
if (OPENLDAP_INCLUDE_DIR AND LIBLDAP AND LIBLBER) | ||
set(OPENLDAP_FOUND TRUE) | ||
else (OPENLDAP_INCLUDE_DIR AND LIBLDAP AND LIBLBER) | ||
set(OPENLDAP_FOUND FALSE) | ||
endif (OPENLDAP_INCLUDE_DIR AND LIBLDAP AND LIBLBER) | ||
find_library(LDAP_LIBRARY ldap) | ||
find_library(LBER_LIBRARY lber) | ||
|
||
if (OPENLDAP_FOUND) | ||
message(STATUS "Found ldap: ${OPENLDAP_INCLUDE_DIR}") | ||
else (OPENLDAP_FOUND) | ||
if (NOT OPENLDAP_INCLUDE_DIR) | ||
message(FATAL_ERROR "Missing required ldap.h (openldap-devel)") | ||
else (NOT OPENLDAP_INCLUDE_DIR) | ||
message (FATAL_ERROR "Missing required LDAP libraries (openldap)") | ||
endif (NOT OPENLDAP_INCLUDE_DIR) | ||
endif (OPENLDAP_FOUND) | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(OpenLdap DEFAULT_MSG | ||
OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY) | ||
|
||
set(OPENLDAP_LIBS ${LIBLDAP} ${LIBLBER}) | ||
set(OPENLDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY}) | ||
|
||
mark_as_advanced( | ||
OPENLDAP_INCLUDE_DIR OPENLDAP_LIB_DIR OPENLDAP_LIBRARIES | ||
) | ||
OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,18 @@ | ||
# - Find AIO | ||
# | ||
# AIO_INCLUDE - Where to find AIO/aio.h | ||
# AIO_INCLUDE - Where to find libaio.h | ||
# AIO_LIBS - List of libraries when using AIO. | ||
# AIO_FOUND - True if AIO found. | ||
|
||
get_filename_component(module_file_path ${CMAKE_CURRENT_LIST_FILE} PATH) | ||
find_path(AIO_INCLUDE_DIR | ||
libaio.h | ||
HINTS $ENV{AIO_ROOT}/include) | ||
|
||
# Look for the header file. | ||
find_path(AIO_INCLUDE | ||
NAMES aio.h | ||
PATHS /usr/include $ENV{AIO_ROOT}/include /opt/local/include /usr/local/include | ||
DOC "Path in which the file AIO/aio.h is located." ) | ||
find_library(AIO_LIBRARIES | ||
aio | ||
HINTS $ENV{AIO_ROOT}/lib) | ||
|
||
mark_as_advanced(AIO_INCLUDE) | ||
|
||
# Look for the library. | ||
# Does this work on UNIX systems? (LINUX) | ||
find_library(AIO_LIBS | ||
NAMES aio | ||
PATHS /usr/lib /usr/lib/x86_64-linux-gnu $ENV{AIO_ROOT}/lib | ||
DOC "Path to AIO library.") | ||
|
||
mark_as_advanced(AIO_LIBS) | ||
|
||
# Copy the results to the output variables. | ||
if (AIO_INCLUDE AND AIO_LIBS) | ||
message(STATUS "Found AIO in ${AIO_INCLUDE} ${AIO_LIBS}") | ||
set(AIO_FOUND 1) | ||
include(CheckCXXSourceCompiles) | ||
set(CMAKE_REQUIRED_LIBRARY ${AIO_LIBS} pthread) | ||
set(CMAKE_REQUIRED_INCLUDES ${AIO_INCLUDE}) | ||
else () | ||
set(AIO_FOUND 0) | ||
endif () | ||
|
||
# Report the results. | ||
if (NOT AIO_FOUND) | ||
set(AIO_DIR_MESSAGE "AIO was not found. Make sure AIO_LIBS and AIO_INCLUDE are set.") | ||
if (AIO_FIND_REQUIRED) | ||
message(FATAL_ERROR "${AIO_DIR_MESSAGE}") | ||
elseif (NOT AIO_FIND_QUIETLY) | ||
message(STATUS "${AIO_DIR_MESSAGE}") | ||
endif () | ||
endif () | ||
|
||
# handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE if | ||
# all listed variables are TRUE | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(aio DEFAULT_MSG AIO_LIBS AIO_INCLUDE) | ||
find_package_handle_standard_args(aio DEFAULT_MSG AIO_LIBRARIES AIO_INCLUDE_DIR) | ||
|
||
mark_as_advanced(AIO_INCLUDE_DIR AIO_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,22 @@ | ||
# - Find Babeltrace | ||
# This module accepts the following optional variables: | ||
# BABELTRACE_PATH_HINT = A hint on BABELTRACE install path. | ||
# | ||
# This module defines the following variables: | ||
# BABELTRACE_FOUND = Was Babeltrace found or not? | ||
# BABELTRACE_EXECUTABLE = The path to lttng command | ||
# BABELTRACE_LIBRARIES = The list of libraries to link to when using Babeltrace | ||
# BABELTRACE_INCLUDE_DIR = The path to Babeltrace include directory | ||
# | ||
# On can set BABELTRACE_PATH_HINT before using find_package(Babeltrace) and the | ||
# module with use the PATH as a hint to find Babeltrace. | ||
# | ||
# The hint can be given on the command line too: | ||
# cmake -DBABELTRACE_PATH_HINT=/DATA/ERIC/Babeltrace /path/to/source | ||
|
||
if(BABELTRACE_PATH_HINT) | ||
message(STATUS "FindBabeltrace: using PATH HINT: ${BABELTRACE_PATH_HINT}") | ||
else() | ||
set(BABELTRACE_PATH_HINT) | ||
endif() | ||
|
||
#One can add his/her own builtin PATH. | ||
#FILE(TO_CMAKE_PATH "/DATA/ERIC/Babeltrace" MYPATH) | ||
#list(APPEND BABELTRACE_PATH_HINT ${MYPATH}) | ||
|
||
find_path(BABELTRACE_INCLUDE_DIR | ||
NAMES babeltrace/babeltrace.h babeltrace/ctf/events.h babeltrace/ctf/iterator.h | ||
PATHS ${BABELTRACE_PATH_HINT} | ||
PATH_SUFFIXES include | ||
DOC "The Babeltrace include headers") | ||
|
||
find_path(BABELTRACE_LIBRARY_DIR | ||
NAMES libbabeltrace.so | ||
NAMES libbabeltrace-ctf.so | ||
PATHS ${BABELTRACE_PATH_HINT} | ||
PATH_SUFFIXES lib lib64 | ||
DOC "The Babeltrace libraries") | ||
|
||
find_library(BABELTRACE NAMES babeltrace babeltrace-ctf PATHS ${BABELTRACE_LIBRARY_DIR}) | ||
NAMES babeltrace/babeltrace.h babeltrace/ctf/events.h babeltrace/ctf/iterator.h) | ||
|
||
set(BABELTRACE_LIBRARIES ${BABELTRACE}) | ||
find_library(BABELTRACE_LIBRARY | ||
NAMES babeltrace babeltrace-ctf) | ||
|
||
message(STATUS "Looking for Babeltrace...") | ||
set(BABELTRACE_NAMES "babeltrace;babeltrace-ctf") | ||
# FIND_PROGRAM twice using NO_DEFAULT_PATH on first shot | ||
find_program(BABELTRACE_EXECUTABLE | ||
NAMES ${BABELTRACE_NAMES} | ||
PATHS ${BABELTRACE_PATH_HINT}/bin /bin | ||
NO_DEFAULT_PATH | ||
DOC "The BABELTRACE command line tool") | ||
NAMES babeltrace babeltrace-ctf) | ||
|
||
# handle the QUIETLY and REQUIRED arguments and set PRELUDE_FOUND to TRUE if | ||
# all listed variables are TRUE | ||
include(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BABELTRACE | ||
REQUIRED_VARS BABELTRACE_INCLUDE_DIR BABELTRACE_LIBRARY_DIR) | ||
# VERSION FPHSA options not handled by CMake version < 2.8.2) | ||
# VERSION_VAR) | ||
mark_as_advanced(BABELTRACE_INCLUDE_DIR) | ||
mark_as_advanced(BABELTRACE_LIBRARY_DIR) | ||
find_package_handle_standard_args(BABELTRACE DEFAULT_MSG | ||
BABELTRACE_INCLUDE_DIR BABELTRACE_LIBRARY) | ||
set(BABELTRACE_LIBRARIES ${BABELTRACE_LIBRARY}) | ||
mark_as_advanced(BABELTRACE_INCLUDE_DIR BABELTRACE_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.