OSDN Git Service

add NSL CMake module
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 5 Nov 2016 00:06:43 +0000 (00:06 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 5 Nov 2016 00:06:43 +0000 (00:06 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
cmake/modules/FindNSL.cmake [new file with mode: 0644]

diff --git a/cmake/modules/FindNSL.cmake b/cmake/modules/FindNSL.cmake
new file mode 100644 (file)
index 0000000..10e0be5
--- /dev/null
@@ -0,0 +1,37 @@
+# - Try to find NSL
+# Once done this will define
+#
+#  NSL_FOUND - system has NSL
+#  NSL_INCLUDES - the NSL include directory
+#  NSL_LIBRARIES - The libraries needed to use NSL
+#
+# Copyright (c) 2016, Ivailo Monev, <xakepa10@gmail.com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+if(NSL_INCLUDES AND NSL_LIBRARIES)
+    set(NSL_FIND_QUIETLY TRUE)
+endif()
+
+# NSL does not provide pkg-config files
+
+find_path(NSL_INCLUDES
+    NAMES
+    rpcsvc/ypclnt.h
+    HINTS
+    $ENV{NSLDIR}/include
+    ${INCLUDE_INSTALL_DIR}
+)
+
+find_library(NSL_LIBRARIES
+    NAMES
+    nsl c
+    HINTS
+    $ENV{NSLDIR}/lib
+    ${LIB_INSTALL_DIR}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(NSL DEFAULT_MSG NSL_INCLUDES NSL_LIBRARIES)
+
+mark_as_advanced(NSL_INCLUDES NSL_LIBRARIES)