Skip to content

Commit

Permalink
cmake check for libattr
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Moody <[email protected]>
  • Loading branch information
adammoody committed Jan 8, 2022
1 parent 928fe9f commit 3e15ca3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
OPTION(ENABLE_XATTRS "Enable code for extended attributes" ON)
IF(ENABLE_XATTRS)
ADD_DEFINITIONS(-DDCOPY_USE_XATTRS)

FIND_PACKAGE(LibAttr REQUIRED)
IF(LibAttr_FOUND)
ADD_DEFINITIONS(-DHAVE_LIBATTR)
INCLUDE_DIRECTORIES(${LibAttr_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${LibAttr_LIBRARIES})
ENDIF(LibAttr_FOUND)
ENDIF(ENABLE_XATTRS)

OPTION(ENABLE_LUSTRE "Enable optimization and features for Lustre" OFF)
Expand Down
25 changes: 25 additions & 0 deletions cmake/FindLibAttr.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# - Try to find libattr
# Once done this will define
# LibAttr_FOUND - System has libattr
# LibAttr_INCLUDE_DIRS - The libattr include directories
# LibAttr_LIBRARIES - The libraries needed to use libattr

FIND_LIBRARY(LibAttr_LIBRARIES
NAMES attr
)

FIND_PATH(LibAttr_INCLUDE_DIRS
NAMES attr/libattr.h
)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibAttr DEFAULT_MSG
LibAttr_LIBRARIES
LibAttr_INCLUDE_DIRS
)

# Hide these vars from ccmake GUI
MARK_AS_ADVANCED(
LibAttr_LIBRARIES
LibAttr_INCLUDE_DIRS
)

0 comments on commit 3e15ca3

Please sign in to comment.