]> git.stg.codes - stg.git/blobdiff - cmake/modules/FindMNL.cmake
Port to CMake, get rid of os_int.h.
[stg.git] / cmake / modules / FindMNL.cmake
diff --git a/cmake/modules/FindMNL.cmake b/cmake/modules/FindMNL.cmake
new file mode 100644 (file)
index 0000000..833f1bc
--- /dev/null
@@ -0,0 +1,22 @@
+find_path ( MNL_INCLUDE_DIR NAMES libmnl/libmnl.h DOC "Path to MNL header files." )
+mark_as_advanced ( MNL_INCLUDE_DIR )
+
+find_library ( MNL_LIB NAMES mnl DOC "Location of MNL library." )
+mark_as_advanced ( MNL_LIB )
+
+include ( FindPackageHandleStandardArgs )
+find_package_handle_standard_args ( MNL
+                                    REQUIRED_VARS MNL_LIB MNL_INCLUDE_DIR
+                                    VERSION_VAR MNL_VERSION )
+
+# Create the imported target
+if ( MNL_FOUND )
+    set ( MNL_INCLUDE_DIRS ${MNL_INCLUDE_DIR} )
+    set ( MNL_LIBRARIES ${MNL_LIB} )
+    if ( NOT TARGET MNL::MNL )
+        add_library ( MNL::MNL UNKNOWN IMPORTED )
+        set_target_properties ( MNL::MNL PROPERTIES
+                                IMPORTED_LOCATION "${MNL_LIB}"
+                                INTERFACE_INCLUDE_DIRECTORIES "${MNL_INCLUDE_DIR}" )
+    endif ( NOT TARGET MNL::MNL )
+endif ( MNL_FOUND )