Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Findrados.cmake #539

Merged
merged 1 commit into from
Feb 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Findrados.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) 2017 MohamedGhaith.Kaabi@gmail.com

# - Try to find the Rados library
# Once done this will define
#
# RADOS_ROOT - Set this variable to the root installation
#
# Read-Only variables:
# RADOS_FOUND - system has the Rados library
# RADOS_INCLUDE_DIR - the Rados include directory
# RADOS_LIBRARIES - The libraries needed to use Rados
# RADOS_VERSION - This is set to $major.$minor.$patch (eg. 0.9.8)

include(FindPackageHandleStandardArgs)

if(rados_FIND_REQUIRED)
set(_RADOS_output_type FATAL_ERROR)
else()
set(_RADOS_output_type STATUS)
endif()

if(rados_FIND_QUIETLY)
set(_RADOS_output)
else()
set(_RADOS_output 1)
endif()

find_path(_RADOS_INCLUDE_DIR rados/librados.hpp
HINTS ${CMAKE_SOURCE_DIR}/../../.. $ENV{RADOS_ROOT} ${RADOS_ROOT}
PATH_SUFFIXES include
PATHS /usr /usr/local /opt /opt/local)

find_library(RADOS_LIBRARY rados
HINTS ${CMAKE_SOURCE_DIR}/../../.. $ENV{RADOS_ROOT} ${RADOS_ROOT}
PATH_SUFFIXES lib lib64
PATHS /usr /usr/local /opt /opt/local)

if(rados_FIND_REQUIRED)
if(RADOS_LIBRARY MATCHES "RADOS_LIBRARY-NOTFOUND")
message(FATAL_ERROR "Missing the rados library.\n"
"Consider using CMAKE_PREFIX_PATH or the RADOS_ROOT environment variable. "
"See the ${CMAKE_CURRENT_LIST_FILE} for more details.")
endif()
endif()
find_package_handle_standard_args(rados DEFAULT_MSG
RADOS_LIBRARY _RADOS_INCLUDE_DIR)

if(_RADOS_EPIC_FAIL)
set(RADOS_FOUND FALSE)
set(RADOS_LIBRARY)
set(_RADOS_INCLUDE_DIR)
set(RADOS_INCLUDE_DIRS)
set(RADOS_LIBRARIES)
else()
set(RADOS_INCLUDE_DIRS ${_RADOS_INCLUDE_DIR})
set(RADOS_LIBRARIES ${RADOS_LIBRARY})
if(_RADOS_output)
message(STATUS
"Found rados in ${RADOS_INCLUDE_DIRS};${RADOS_LIBRARIES}")
endif()
endif()