1# FindLibmetal
2# --------
3#
4# Find Libmetal
5#
6# Find the native Libmetal includes and library this module defines
7#
8# ::
9#
10#   LIBMETAL_INCLUDE_DIR, where to find metal/sysfs.h, etc.
11#   LIBSYSFS_LIB_DIR, where to find libmetal library.
12
13# FIX ME, CMAKE_FIND_ROOT_PATH doesn't work
14# even use the following
15# set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
16# set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
17# set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
18find_path(LIBMETAL_INCLUDE_DIR NAMES metal/sys.h PATHS ${CMAKE_FIND_ROOT_PATH})
19find_library(LIBMETAL_LIB NAMES metal PATHS ${CMAKE_FIND_ROOT_PATH})
20get_filename_component(LIBMETAL_LIB_DIR ${LIBMETAL_LIB} DIRECTORY)
21
22# handle the QUIETLY and REQUIRED arguments and set HUGETLBFS_FOUND to TRUE if
23# all listed variables are TRUE
24include (FindPackageHandleStandardArgs)
25FIND_PACKAGE_HANDLE_STANDARD_ARGS (Libmetal DEFAULT_MSG LIBMETAL_LIB LIBMETAL_INCLUDE_DIR)
26
27if (LIBMETAL_FOUND)
28  set (LIBMETAL_LIBS ${LIBMETAL_LIB})
29endif (LIBMETAL_FOUND)
30
31mark_as_advanced (LIBMETAL_LIB LIBMETAL_INCLUDE_DIR LIBMETAL_LIB_DIR)
32