summaryrefslogtreecommitdiffstats
path: root/project/cmake/modules/FindNFS.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/modules/FindNFS.cmake')
-rw-r--r--project/cmake/modules/FindNFS.cmake58
1 files changed, 58 insertions, 0 deletions
diff --git a/project/cmake/modules/FindNFS.cmake b/project/cmake/modules/FindNFS.cmake
new file mode 100644
index 0000000..3fd9d61
--- /dev/null
+++ b/project/cmake/modules/FindNFS.cmake
@@ -0,0 +1,58 @@
1#.rst:
2# FindNFS
3# -------
4# Finds the libnfs library
5#
6# This will will define the following variables::
7#
8# NFS_FOUND - system has libnfs
9# NFS_INCLUDE_DIRS - the libnfs include directory
10# NFS_LIBRARIES - the libnfs libraries
11# NFS_DEFINITIONS - the libnfs compile definitions
12#
13# and the following imported targets::
14#
15# NFS::NFS - The libnfs library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(NFS libnfs QUIET)
19endif()
20
21find_path(NFS_INCLUDE_DIR nfsc/libnfs.h
22 PATHS ${PC_NFS_INCLUDEDIR})
23
24set(NFS_VERSION ${PC_NFS_VERSION})
25
26include(FindPackageHandleStandardArgs)
27if(NOT WIN32)
28 find_library(NFS_LIBRARY NAMES nfs
29 PATHS ${PC_NFS_LIBDIR})
30
31 find_package_handle_standard_args(NFS
32 REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR
33 VERSION_VAR NFS_VERSION)
34else()
35 # Dynamically loaded DLL
36 find_package_handle_standard_args(NFS
37 REQUIRED_VARS NFS_INCLUDE_DIR
38 VERSION_VAR NFS_VERSION)
39endif()
40
41if(NFS_FOUND)
42 set(NFS_LIBRARIES ${NFS_LIBRARY})
43 set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR})
44 set(NFS_DEFINITIONS -DHAVE_LIBNFS=1)
45
46 if(NOT TARGET NFS::NFS)
47 add_library(NFS::NFS UNKNOWN IMPORTED)
48 if(NFS_LIBRARY)
49 set_target_properties(NFS::NFS PROPERTIES
50 IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}")
51 endif()
52 set_target_properties(NFS::NFS PROPERTIES
53 INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}"
54 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBNFS=1)
55 endif()
56endif()
57
58mark_as_advanced(NFS_INCLUDE_DIR NFS_LIBRARY)