Add CMake module for look for libmetal
authorWendy Liang <jliang@xilinx.com>
Fri, 27 May 2016 20:38:48 +0000 (13:38 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:41 +0000 (22:01 -0700)
Add a CMake module to look for the libmetal library
and header files.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
cmake/modules/FindLibmetal.cmake [new file with mode: 0644]

diff --git a/cmake/modules/FindLibmetal.cmake b/cmake/modules/FindLibmetal.cmake
new file mode 100644 (file)
index 0000000..32a9452
--- /dev/null
@@ -0,0 +1,22 @@
+# FindLibmetal
+# --------
+#
+# Find Libmetal
+#
+# Find the native Libmetal includes and library this module defines
+#
+# ::
+#
+#   LIBMETAL_INCLUDE_DIR, where to find metal/sysfs.h, etc.
+#   LIBSYSFS_LIB_DIR, where to find libmetal library.
+
+# FIX ME, CMAKE_FIND_ROOT_PATH doesn't work
+# even use the following
+# set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
+# set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
+# set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+find_path(LIBMETAL_INCLUDE_DIR NAMES metal/sys.h PATHS ${CMAKE_FIND_ROOT_PATH})
+find_library(LIBMETAL_LIB NAMES metal PATHS ${CMAKE_FIND_ROOT_PATH})
+get_filename_component(LIBMETAL_LIB_DIR ${LIBMETAL_LIB} DIRECTORY)
+
+mark_as_advanced (LIBMETAL_INCLUDE_DIR LIBMETAL_LIB_DIR)