From 9fc8b732737f139d3e466510d75668ab45578960 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 8 Mar 2016 21:02:53 +0100 Subject: sync with upstream --- project/cmake/modules/FindNFS.cmake | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 project/cmake/modules/FindNFS.cmake (limited to 'project/cmake/modules/FindNFS.cmake') 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 @@ +#.rst: +# FindNFS +# ------- +# Finds the libnfs library +# +# This will will define the following variables:: +# +# NFS_FOUND - system has libnfs +# NFS_INCLUDE_DIRS - the libnfs include directory +# NFS_LIBRARIES - the libnfs libraries +# NFS_DEFINITIONS - the libnfs compile definitions +# +# and the following imported targets:: +# +# NFS::NFS - The libnfs library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(NFS libnfs QUIET) +endif() + +find_path(NFS_INCLUDE_DIR nfsc/libnfs.h + PATHS ${PC_NFS_INCLUDEDIR}) + +set(NFS_VERSION ${PC_NFS_VERSION}) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(NFS_LIBRARY NAMES nfs + PATHS ${PC_NFS_LIBDIR}) + + find_package_handle_standard_args(NFS + REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR + VERSION_VAR NFS_VERSION) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(NFS + REQUIRED_VARS NFS_INCLUDE_DIR + VERSION_VAR NFS_VERSION) +endif() + +if(NFS_FOUND) + set(NFS_LIBRARIES ${NFS_LIBRARY}) + set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR}) + set(NFS_DEFINITIONS -DHAVE_LIBNFS=1) + + if(NOT TARGET NFS::NFS) + add_library(NFS::NFS UNKNOWN IMPORTED) + if(NFS_LIBRARY) + set_target_properties(NFS::NFS PROPERTIES + IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}") + endif() + set_target_properties(NFS::NFS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBNFS=1) + endif() +endif() + +mark_as_advanced(NFS_INCLUDE_DIR NFS_LIBRARY) -- cgit v1.2.3